Is it possible to accept custom command line parameters with Inno Setup

Similar picture Similar · Sep 1, 2010 · Viewed 29.2k times · Source

I am preparing an installer with Inno Setup. But I'd like to add an additional custom (none of the available parameters) command line parameters and would like to get the value of the parameter, like:

setup.exe /do something

Check if /do is given, then get the value of something. Is it possible? How can I do this?

Answer

Dan Locks picture Dan Locks · Feb 5, 2015

With InnoSetup 5.5.5 (and perhaps other versions), just pass whatever you want as a parameter, prefixed by a /

c:\> myAppInstaller.exe /foo=wiggle

and in your myApp.iss:

[Setup]
AppName = {param:foo|waggle}

The |waggle provides a default value if no parameter matches. Inno setup is not case sensitive. This is a particularly nice way to handle command line options: They just spring into existence. I wish there was as slick a way to let users know what command line parameters the installer cares about.

BTW, this makes both @knguyen's and @steve-dunn's answers somewhat redundant. The utility functions do exactly what the built-in {param: } syntax does.