Can a batch file capture the exit codes of the commands it is invoking?

前端 未结 4 1455
刺人心
刺人心 2021-02-12 08:34

Basically, let\'s say that I have a batch file that calls myapp1.exe and myapp1.exe exits with Exit Code 1. Can the batch file capture this information and either force the batc

4条回答
  •  无人及你
    2021-02-12 09:13

    %ERRORLEVEL% stores the return value of last executed command

    call program.exe
    echo program.exe returns "%ERRORLEVEL%"
    IF %ERRORLEVEL% NEQ 0 (
      echo FAILED
    )
    

提交回复
热议问题