I have scripts which has many DOS copy / xcopy / move statements. I do not want to code if %ERRORLEVEL% after each statement which is completely inefficient, anyone have thoughts for the best way in handling this?
copy statement 1
call errorhandler
copy statement 2
call errorhandler
copy statement 3
....
if errorfile size greater than zero, email error
:end
-----------------------------------------------------------------------------------------------------------------------
In the errorhandler, it would be best if it can check for the errorlevel from the copy | xcopy | move,
if errorlevel equal zero: return to caller
if errorlevel greater than zero:
write to some errorfile
return to caller to execute next statement....
I would think that as soon as I issue a call statement, the errorlevel would change. Any ideas?