Need some error control with a script

Microsoft Windows xp professional editio...
October 9, 2009 at 17:35:19
Specs: Windows XP
I have this script I use to copy some files and directories for a kind of back up job. The script works fine. The problem is that if someone has a file open or something goes wrong during the copy operation, I am not notified. The script just ends. There is nothing showing things bombed out. What can I add to my script so it will say if completed with or without errors? If I run it knowing a file is open, the cmd window closed immediatly, if things are going good I can at least see it copying the files. I just assume if it is open for awhile things when good, which is just assuming something did not go wrong at the end. Please help. Here is the current script, it runs in a .bat file.

==========================
@echo off
setlocal enabledelayedexpansion
for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set target=C:\Backup\%%A%%B%%C
xcopy "\\192.168.1.8\Shared\*" "%target%\" /E /-Y
================================

Thanks in advance for the help


See More: Need some error control with a script

Report •


#1
October 9, 2009 at 22:29:47
@echo off
call mybakup
if %errorlevel% 1 echo something goofed
pause


=====================================
Helping others achieve escape felicity

M2


Report •

#2
October 13, 2009 at 06:22:43
I cannot get your recommendation to work, can you clarify where I need to put your script within my existing one. Also it looks like yours will only pop up if there is an error. I would also like to know if the job was sucessfull.

Report •

#3
October 13, 2009 at 06:48:51
Now that I've thought more about it, I doubt this will help.

You might try putting some error checking inside the FOR loop. But even at that, xcopy puts out some odd results.


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions


Ask Question