I have two Windows 2008 SP2 servers, one dev other production. Production has Microsoft CLuster services running. Now in one particular batch script following commands are there:
dsmc incr "%ARCHIVE_DIR%\*"
if errorlevel 1 goto EXCPT
more code to do purging
Excpt:
echo "script backup error"
In dev this works as expected, dsmc incr returns 8 on successful completion and script moves to purging code. However in production even though dsmc incr return 8, the errorlevel always evaluates to 1 and it jumps to Excpt: . Can anyone help on this please ?
Check
IF
help!You will find:
So,
will evaluate true for any errorlevel>=1.
To get exact matching, use:
or
Last one will not work on environments where
ERRORLEVEL
is used as environment variable.