Hi there! Today I’m going to show you how to extend your InstallAware setup packages to support custom command line switches. A frequent question we get is “why don’t standard MSI command line switches work?” The answer is really simple – InstallAware has its own bootstrapper and the command line parameters it accepts are well documented under the help topic “Setup Command Line Parameters“. In a nutshell, /s makes setup run silently, /l=<full path to log file> turns on logging, and you can pass variable values using the form “TARGETDIR=<path value>” (including the quotes, if you are specifying values with spaces in them).
Now that we’ve gotten the basics out of the way, let’s talk about how to extend this behavior. For instance, you might have some real difficult customers who have this irrational insistence on sticking to standard MSI command line parameters. Or, more legitimately, you might be wanting to define your own custom command line parameters to do whatever you feel like doing with.
The $CMDLINE$ pre-defined script variable contains the exact command line passed to your installer. You can investigate what this variable contains using the If script command together with the Contains expression. This will make it very easy for you to test for the presence of custom command line switches. For instance, take a look at the following code snippet:
if Variable CMDLINE Contains /quiet
Set Variable SILENT to TRUE
This snippet uses the pre-defined script variable $SILENT$ to turn on silent installation mode when /quiet, a standard MSI command line parameter, has been passed to your installer. Easy enough!
For more complex evaluations, you can assign the $CMDLINE$ pre-defined script variable to a custom variable and then use the Parse String command to extract exactly whatever you need without destroying the contents of the original command line variable.
Talk to you soon!
your friendly support engineer