Solved

Add code to display "Backup succesful"

Posted on 2014-03-30
2
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

726 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