Tech Notes

InnoSetupLogo

Inno Setup Command Line Ideas

Inno Setup allows you to create a Windows installer for your software application from a “Inno Setup Script”. I recommend that you use the InnoIDE to help you create your script. Take a look at the comprehensive examples that Inno Setup come with as a starting point for your own installer script.

Variable Passing

You may have a parameter in your Inno Setup script that can have a number of values.

Here’s an example of a variable declaration in the {Setup} section of an Inno Setup script:

[Setup]
.
.
.
VersionInfoProductName={#AppName}
VersionInfoProductVersion={#AppVersion}
WizardImageBackColor={#BackCol}
.
.
.

Here we are leaving the assignment of VersionInfoProductName, VersionInfoProductVersion and WizardImageBackColor to be set to parameters specified at the command line.

You may also have a parameter that is passed in, but is not set to an Inno Setup variable. Instead it is used directly in the script as follows:

[Files]
Source: "packrat-server-{#BuildType}\*"; DestDir: "{app}\LatLong Systems"; Flags: ignoreversion recursesubdirs createallsubdirs

Here the parameter BuildType is being used to tell the script where to find the baseline of files that make up the build are found. You may have build types of “demo” and “full”, so would have the following directories at the same level as your Inno Setup script file:

packrat-server-demo

packrat-server-full

Each of these directories contains the specific files for the type of build being performed.

Build Batch File

In a batch file, you can specify these parameter values at the Inno Setup compiler command line as follows:

set TYPE=%1

if "%TYPE%"=="demo" goto DEMO
if "%TYPE%"=="full" goto FULL

:DEMO
echo.
echo ###########################################################
echo Building DEMO PackRat Server Installer
echo.
set NAME=PackRat Server Demo
set COLOUR_BK=clSilver
goto END

:FULL
echo.
echo ###########################################################
echo Building FULL PackRat Server Installer
echo.

set NAME=PackRat Server
set COLOUR_BK=$0000D7FF
goto END

:END
C:\"Program Files (x86)\Inno Setup 5"\iscc "/dBuildType=%TYPE%" "/dBackCol=%COLOUR_BK%" "/dAppName=%NAME%" "/dAppVersion=1.0" packratserver_innosetup.iss

When running your batch file to build your installer, you would do the following:

> build_installer.bat demo

to build the Demonstration version, or:

> build_installer.bat full

to build the Full version.

Summary

It is easy to parameterise your Windows installer builds using Inno Setup’s command line functionality. Good luck with your own installer scripts.

Back to Tech Notes page