Solved

Add code to display "Backup succesful"

Posted on 2014-03-30
2
259 Views
Last Modified: 2014-03-31
I .. I am running a .bat file with this code:

xCopy /E/Y C:\BDotAttachments\*.* F:\Live\

I want to add a line at the end so that IF the command runs successfully it will show an alert saying "Backup complete" or something. What should I add at the end of the .bat file ?
0
Comment
Question by:amucinobluedot
2 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39966261
After your XCOPY line you want something like:
IF ERRORLEVEL 0 ECHO "Backup complete"

Open in new window

0
 
LVL 11

Accepted Solution

by:
paultomasi earned 500 total points
ID: 39966542
It's always a good idea to get the system error code should a problem occur.

@echo off

echo Starting backup process...

xcopy /e /y c:\bdotattachments\*.* f:\live\

if %errorlevel% gtr 0 (
  echo ERROR [%errorlevel%]: Backup process completed but with error(s).
) else (
  echo Backup process completed successfully.
)

pause

Open in new window

0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now