?
Solved

Add code to display "Backup succesful"

Posted on 2014-03-30
2
Medium Priority
?
274 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 2000 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

771 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