This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallAnywhere
- :
- InstallAnywhere Forum
- :
- Thank You!!
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
โSep 22, 2008
11:54 AM
Windows bat scripts and EXECUTE_EXITCODE
Thought I would pass on this bit of information for anyone using the "Execute Script/Bat fFile" action with Windows.
If you exit your bat script with this:
exit /b 1
The EXECUTE_EXITCODE will be set to 0.
If you really want to capture the exitcode, you need to use:
exit 1
Why is this important? I was testing my bat script with "exit /b 1" until I was satisfied with my unit testing. I then pasted my script into the action, but my installer unit testing showed the EXECUTE_EXITCODE was _always_ set to 0. It took me a few iterations to figure out why,. For some reason the /b argument doesn't do what I expected in IA.
Hope this is helpful information for you.
If you exit your bat script with this:
exit /b 1
The EXECUTE_EXITCODE will be set to 0.
If you really want to capture the exitcode, you need to use:
exit 1
Why is this important? I was testing my bat script with "exit /b 1" until I was satisfied with my unit testing. I then pasted my script into the action, but my installer unit testing showed the EXECUTE_EXITCODE was _always_ set to 0. It took me a few iterations to figure out why,. For some reason the /b argument doesn't do what I expected in IA.
Hope this is helpful information for you.
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
โJan 29, 2009
10:42 AM
bobdux,
Should you ever find yourself in the UK, I owe you at least a dozen pints! I have been going mad for a day as to why the return was always zero when my code seemed correct. I was messing with cscript, testing in VS, other shells, and everything worked there.
Then I discovered this post searching for 'execute' since using 'execute_stdexitcode' returned nothing(?) and within ten minutes a received the expected -1 that I had assigned to the variable in my JS. ๐
Brilliant!
Thanks
Should you ever find yourself in the UK, I owe you at least a dozen pints! I have been going mad for a day as to why the return was always zero when my code seemed correct. I was messing with cscript, testing in VS, other shells, and everything worked there.
Then I discovered this post searching for 'execute' since using 'execute_stdexitcode' returned nothing(?) and within ten minutes a received the expected -1 that I had assigned to the variable in my JS. ๐
Brilliant!
Thanks
![](/skins/images/D60DF682EA37BF37032955CE10F3F0BB/responsive_peak/images/icon_anonymous_message.png)