Solved

Add code to display "Backup succesful"

Posted on 2014-03-30
2
262 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exchange 2013 where are images stored? 2 43
Date variable in batch file 2 27
WMIC Command LIne 5 27
Bot attack question 11 20
What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

770 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