I am trying to run a batch file with start /high
and still get the return/exit code, i.e. %ERRORLEVEL%
. The problem seems to be that command START does not return the exit code that the batch file returns.
We have a simple batch file for testing named BatFileThatReturnsOne.bat
.
The contents of BatFileThatReturnsOne.bat
are
EXIT /B 1
We are calling this as such:
start /high /wait BatFileThatReturnsOne.bat
But no matter what the batch file returns, the execution of start
never has a %ERRORLEVEL%
of anything other than 0 (zero).
This is all actually called by cfn-init in CloudFormation, but that is probably not relevant because we can reproduce it from a command line window.
The actual call is:
cmd.exe /C start /high /wait BatFileThatReturnsOne.bat
How do I get start
to set the %ERRORLEVEL%
to something other than 0 (zero)?