Community Forums
Page 1 of 2 12 LastLast
Results 1 to 5 of 6

Thread: Executing scripts

  1. #1
    Join Date
    Nov 2007
    Posts
    9

    Smile Executing scripts

    Hi,

    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,

    Regards,
    IAUser123

  2. #2
    Join Date
    Oct 2001
    Location
    Here and there
    Posts
    16,243
    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).

  3. #3
    Join Date
    Nov 2007
    Posts
    9
    Hi,

    Thanks for the reply. Could you please explain briefly on how to use the variable ($EXECUTE_EXITCODE$)?


    Regards,
    IAUser123

  4. #4
    Join Date
    Oct 2001
    Location
    Here and there
    Posts
    16,243
    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.

  5. #5
    Join Date
    Mar 2013
    Posts
    31

    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.

    1. Vitals
      1. InstallAnywhere 2012 Enterprise Edtion with SP1 patch
      2. Windows XP with SP3 patch applied
    2. Desired workflow
      1. In the Pre-Install actions, I did an Add Action -> Execute Script/Batch file:
      2. I cut an paste my batch script into the panel after debugging it and making sure it works.
      3. We are performing an upgrade in the field which means we are installing newer files over older ones.
      4. 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.
      5. My intent is for the script to exit with a non-zero return code and have that be captured in the $EXECUTE_EXITCODE$
      6. 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.
    3. Trouble
      1. For testing, I deliberately setup a system where the read-only attribute was unset for all of the artifacts we care about.
      2. I ran the script outside of InstallAnywhere and it is properly logging the problem and exiting with a return code of 1.
      3. 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$.
      4. 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.
      5. 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?

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •