14
7
I have a batch file that is a wrapper around an installer. This batch file checks the error level returned by the installer and prints accordingly.
I noticed that if I execute set ERRORLEVEL=0
in a command prompt right before kicking off the batch file (in the same command window/environment), the installer never messes with the errorlevel and my batch script always returns passed. I would assume %ERRORLEVEL%
is a variable defined by Windows and is used specifically to print out errors from programs and scripts and that using the variable in a batch file or something else would be 'at your own risk' because it could be changed at any moment by another process.
From what it seems like, when I set errorlevel in the given environment, it then somehow terminates the use of errorlevel as a holder of the exit code. Does anyone know why this is? To me its just weird unexpected behavior. Any information on the subject would be greatly appreciated!
See also Command script exit code not seen by
– Scott – 2020-02-19T01:18:21.287&&
or||
.