Description
Steps using Windows CMD commands can return a successful exit code (0) even if individual commands within the step fail. Reason: the last command in the step determines the exit code.
Solution
Save the ERRORLEVEL of the command, perform the other operations, and then return the desired error level on exit:
ectool badcommand set SAVED_ERRORLEVEL=%ERRORLEVEL% echo Saved errorlevel is %SAVED_ERRORLEVEL% rem Show that the errorlevel has been reset to 0 echo Current errorlevel is %ERRORLEVEL% exit %SAVED_ERRORLEVEL%