I am working with InstallAnywhere 2008 Standard edition. I am using 'Execute Script/Batch file' option to execute few scripts to install various softwares. I would like to execute all these installation scripts based on the output of a script. I mean to say that if this script returns 'o' then execute all other scripts else if it returns '-1' then all other scripts should not be executed. Can anyone tell me how to acheive this?
Please get back to me for any further details.
Thanks in advance,
The first Execute Script/Batch File action should set the value of an IA variable to the script return value ($EXECUTE_EXITCODE$, by default); you could then use that variable in a rule on subsequent script actions (or on an action group containing the other script actions).
Thanks for the reply. Could you please explain briefly on how to use the variable ($EXECUTE_EXITCODE$)?
To use the value of a variable in a conditional statement, you can select the Rules tab in an action's customizer, click Add Rule, and select Compare InstallAnywhere Variables. In the rule's settings, then, you can compare $EXECUTE_EXITCODE$ with the desired return value.
Getting $EXECUTE_EXITECODE$ set to return code from batch script
I have been lurking in the IA forum and some other script/batch programming forums to figure out why I am not getting this to work.
- InstallAnywhere 2012 Enterprise Edtion with SP1 patch
- Windows XP with SP3 patch applied
- Desired workflow
- In the Pre-Install actions, I did an Add Action -> Execute Script/Batch file:
- I cut an paste my batch script into the panel after debugging it and making sure it works.
- We are performing an upgrade in the field which means we are installing newer files over older ones.
- The batch script's function is to ensure that a certain list of files has the read-only attribute set. If the attribute is not set for any of the files in question, that means we have a broken system and we don't want to do the upgrade.
- My intent is for the script to exit with a non-zero return code and have that be captured in the $EXECUTE_EXITCODE$
- Then I added a rule at the Install action to Compare InstallAnywhere Variables Numerically. I am comparing $EXECUTE_EXITCODE$(left parameter) to 0. In the bottom it says Perform only if: I presume that means perform the install only if $EXECUTE_EXITCODE$ is 0.
- For testing, I deliberately setup a system where the read-only attribute was unset for all of the artifacts we care about.
- I ran the script outside of InstallAnywhere and it is properly logging the problem and exiting with a return code of 1.
- When I run it inside of InstallAnywhere, it does the logging stuff correctly and bails out where it should but the return code is not being captured in $EXECUTE_EXITCODE$.
- Now I found an entry from 2008 in which that user cautioned not to do exit /b 1 but do exit 1. He said the '/b' hoses things up. So, I removed the '/b' part from my script. No luck.
- Then I saw another post on a Batch scripting forum in which someone recommeded @%COMPSPEC% /C exit 1. That didn't work either.
Question, how do I get the return code from the script captured into $EXECUTE_EXITCODE$. I am probably the gazillionth person to ask. Sorry ... New to batchscripting. Old Unix hand. And while I am at it, can I cut an paste a powershell script in this action, instead?