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 batch file to exit with that same exit code or perform some other logic?
相关问题
- xcopy include folder
- Batch file if string starts by
- Jenkins - cmd is not recognized
- String Manipulation with case sensitivity
- Writing an EXE output to a batch file
相关文章
- How to exit a program with an exit code: C#
- Extracting columns from text file using Perl one-l
- How can one batch file get the exit code of anothe
- How to make jenkins fail at a failing windows batc
- Problems using start-process to call other powersh
- Python utilizing multiple processors
- Why do all Pre-build or Post-build events in Visua
- Windows batch file - how to loop through files in
You could try using
errorlevel
s. Some more info here.%ERRORLEVEL% stores the return value of last executed command
would be the explicit variant.
The accepted answer is correct, but if you are using
call
to call another batch script, and that second batch script is usingSetLocal
, you may need to use a parsing trick to accomplish this. If you are running into this, add the following code before yourexit b
:Now the value of
myvariable
is made available to the calling context and you can see the value in the other script.References:
https://stackoverflow.com/a/16167938/89590
http://www.borngeek.com/2008/05/22/exiting-batch-file-contexts/