Inside a batch file on Windows, I use 7-zip like this:
...\right_path\7z a output_file_name.zip file_to_be_compressed
How could I check the exit code of
7z and take the appropriate action ?
Test for a return code greater than or equal to 1:
or test for a return code equal to 0:
You can use other commands such as
This really works when you have: App1.exe calls -> .bat which runs --> app2.exe
App2 returns errorlevel 1... but you need to catch that in the .bat and re-raise it to app1... otherwise .bat eats the errorlevel and app1 never knows.
This is a check after app2 for errorlevel. If > 0, then the .bat exits and sets errorlevel to 1 for the calling app1.