Question

How can I capture the output of a script?

How can I capture the output of a script?

Answer:

You can create or set the value of an installer variable from the output of a script or program using a <setInstallerVariableFromScriptOutput>. You will have to include a section like the one below inside an action list section of your XML installer project file.


       <setInstallerVariableFromScriptOutput>
           <name>myhostname</name>
           <exec>hostname</exec>
           <execArgs>-f</execArgs>
       </setInstallerVariableFromScriptOutput>

That code will create an installer environment variable called myhostname that will store the output thrown by the program hostname. You can later refer to the content of that variable using {myhostname}.