|
Answer» I have a bat file that i use with xcopy to backup. Is there any way i can program the file to give me a report of any errors it encountered or report it's success. Thanx.XCOPY exit codes:
0 Files were copied without error. 1 No files were found to copy. 2 The user pressed CTRL+C to terminate XCOPY. 4 Initialization error occurred. There is not enough memory or disk space, or you entered an invalid drive name or invalid syntax on the command line. 5 Disk write error occurred.
You can use the ERRORLEVEL parameter on the IF command line in a batch program to process exit codes returned by XCOPY.
Hope this helps. And/or you can have the results of any .bat file output to another file by RUNNING it like......
some.bat >output.txtThanx heaps! i don't know ANYTHING about errorlevel so if u can explain - great - OTHERWISE i guess i will have to figure it out. Thanx again.When DOS commands run, they set a return code that you can use in your batch files.
You can do something like this:
xcopy parameters if errorlevel 0 echo Backup JOB Successful if not errorlevel 0 echo Backup Job NOT successful
You can query any valid XCOPY exit code and perform an action based on the value. The possibilities are limited only by your imagination and cleverness.
Good luck.
|