Inno Setup Frequently Asked Questions

The Inno Setup Frequently Asked Questions contains supplemental information not found in the documentation or the Knowledge Base.

### Functionality

- Translating Inno Setup's Text
- Does it support MBCS (multi-byte character sets)?
- Will it support Windows Installer in the future?
- How do I change the icon of Setup.exe?
- Can Inno Setup do a conditional installation - for example, proceed only if a certain registry key or file exists?
- Is it possible to do a silent install without using the /SILENT or /VERYSILENT command-line parameters?
- Can Setup use the value of a registry entry as the default directory name?

### Problems

- Compiler says "Mismatched or misplaced quotes on parameter"
- My application can't find any of its files when it is started from the shortcut created by Setup. It works fine when I double-click the application's EXE in Explorer.
- When I install a new version of my application without uninstalling the old version first, I get a second entry in Control Panel's Add/Remove Programs.
- Why is the error message "The setup files are corrupted" displayed on some systems?
- Setup gives the message "Unable to register the DLL/OCX: DllRegisterServer export not found"
- After uninstalling, the directories created during installation still exist.
- I run a batch file in the [Run] section, but the window remains on the screen after it finishes executing. I'd like it to "close on exit."
- I've changed DefaultDirName in my script, yet when I run Setup it defaults to the directory I had before.
- I have two [Icons] entries with the same Name, but only one of them gets installed.
- Setup isn't waiting for programs executed by [Run] entries to finish.
- Some languages are missing on the Select Setup Language dialog, or it doesn't show up at all.

### Installation Tasks

- Creating Internet (URL) Shortcuts
- Setting the "Start In" Field on a Shortcut
- Creating File Associations
- Setting Environment Variables
- Setting the "Close on Exit" Box on a Shortcut to an MS-DOS Program
- Making Backups Before Replacing Files
- Installing Different Files Depending on Windows Version
- Settings Permissions on Files, Directories, or Registry Keys
- My installation needs to do something that Inno Setup apparently doesn't have a feature for.

### How Do I Install...?

- OCX Files
- Visual Basic System Files
- Visual C++ System Files (e.g. MFC)
- COMCTL32.DLL
- BDE (Borland Database Engine)
- MDAC, ADO, Jet, etc.

### Compatibility

- OS Compatibility
- Administrative Privileges

### Miscellaneous

- Are there any limits on how many files, etc. may be included in an installation?
- What exactly happens when the user clicks Cancel during an installation?

## Functionality

#### Translating Inno Setup's Text

> Translating Inno Setup's text into another language does not require modifying the source code. Simply make a copy of the Default.isl file (included with Inno Setup) and start editing the text in it. (Do not directly edit the Default.isl file, otherwise your changes will be lost when you install a new Inno Setup version.) See the "[Messages] Section" topic in the Inno Setup help file for some important tips.

> Once you have finished creating the new .isl file, create a [Languages] section to tell the compiler to use it:

> `[Languages]
> Name: mytrans; MessagesFile: "compiler:MyTranslation.isl"`

> If you're using a version of Inno Setup prior to 4.0, use this instead:

> `[Setup]
> MessagesFile=compiler:MyTranslation.isl`

> There are many contributed translations available for download on the Inno Setup Third-Party Files page, as well as a program to assist in editing the .isl file.

#### Does it support MBCS (multi-byte character sets)?

> Inno Setup 2.0.6 adds complete support for MBCS. It does lead byte checking on all filename and constant parsing, so it should no longer mistake trail bytes for backslashes ("\") or braces ("{").

> Versions prior to 2.0.6 did not include any special support for MBCS.

#### Will it support Windows Installer in the future?

> At the present time, there are no plans for a Windows Installer edition of Inno Setup. "Supporting" Windows Installer would likely involve a near-complete rewrite of the program.

#### How do I change the icon of Setup.exe?

> The installer's icon may be changed by setting the `SetupIconFile` [Setup] section directive. To set the uninstaller's icon, set `UninstallIconFile`.

#### Can Inno Setup do a conditional installation - for example, proceed only if a certain registry key or file exists?

> Inno Setup 4 adds support for this through the new Pascal Scripting feature.

> Note: with earlier Inno Setup versions it was already possible to install different files depending on the Windows version.

#### Is it possible to do a silent install without using the /SILENT or /VERYSILENT command-line parameters?

> No, nor is such a feature planned (it would be abused). If it is your intention to keep user interaction to a minimum, use the Disable* [Setup] section directives.

#### Can Setup use the value of a registry entry as the default directory name?

> Yes. Use a {reg:...} constant in DefaultDirName. For example:

> `[Setup]
> DefaultDirName={reg:HKLM\Software\My Program,Path|{pf}\My Program}
> `

> See the "Constants" topic in the Inno Setup help file for more information on {reg:...} constants.

## Problems

#### Compiler says "Mismatched or misplaced quotes on parameter"

> This message is typically displayed if you try to embed a quote (") character in a parameter's data, but do not double it as required. Read the "Parameters in Sections" topic in the Inno Setup help file for more information.

#### My application can't find any of its files when it is started from the shortcut created by Setup. It works fine when I double-click the application's EXE in Explorer.

> Your application is most likely not specifying pathnames on the files it is trying to open, so it is expecting to find them in the current directory. Inno Setup by default does not set the "Start In" field on shortcuts its creates; this causes Windows to pick a directory itself, which usually won't be the directory containing your application.

> In virtually all cases, this is something that should be corrected at the application level. Properly designed GUI applications should not expect to be started from a particular directory; they should always specify full pathnames on files they open. In Delphi or C++Builder, for example, it's possible to get the full pathname of the directory containing the application EXE by calling: `ExtractFilePath(ParamStr(0))`. To get the full path of a file named "File.txt" in the application directory, use: `ExtractFilePath(ParamStr(0)) + 'File.txt'`.

> If for some reason you cannot fix this at the application level, you can tell Inno Setup to set the "Start In" field by adding "WorkingDir: {app}" to your [Icons] entries.

#### Why is the error message "The setup files are corrupted" displayed on some systems?

> This error message is displayed when a file pertaining to the installation (e.g., setup.exe, setup.1) has the wrong size, or part of a file fails a CRC check. It is not displayed for any other reason.

> If your installation is distributed over the internet and you're getting a lot of reports of this error, it could be that your web server is delivering partial files by dropping connections prematurely. Have the affected users check the size in the bytes of the file(s) they downloaded.

> If your installation is distributed via CD-ROM or floppy disk, it could be that the CD-ROM or floppy disk is bad, or possibly the drive is defective.

#### When I install a new version of my application without uninstalling the old version first, I get a second entry in Control Panel's Add/Remove Programs.

> This happens when you change AppId between versions, or if AppId is not specified, AppName. If you do that, Setup has no way of knowing that the two versions are of the same application, and thus will create a new entry in Add/Remove Programs. Additionally, a new uninstall log file (unins???.dat) will be created. The obvious solution for this is to not change AppId or AppName.

> If you must change AppName in a new version, set AppId to the value of AppId or AppName from the previous version.

#### Setup gives the message "Unable to register the DLL/OCX: DllRegisterServer export not found"

> This message normally means that you specified the "regserver" flag on a file that doesn't possess the ability to be registered. Remove the "regserver" flag from the [Files] entry and the message will go away.

#### After uninstalling, the directories created during installation still exist.

> There are several reasons why a directory may not be removed:

> - It already existed prior to installation. By default, the uninstaller plays it safe and doesn't remove directories that the installer didn't create.
> - It contains files or subdirectories. Use [UninstallDelete] if you need the uninstaller to delete additional files/directories.
> - A running process has the directory as its current directory.

> Note: In Inno Setup versions prior to 2.0.1, directories must be specified in either the [Dirs] or [UninstallDelete] sections for them to be deleted by the uninstaller. In newer Inno Setup versions, directories created by [Files] section entries will be deleted automatically by the uninstaller if they didn't exist prior to installation.

#### I run a batch file in the [Run] section, but the window remains on the screen after it finishes executing. I'd like it to "close on exit."

> From Tim Rude:
> The simplest way to get a batch file to automatically close on exit is to clear the screen at the end of it using the CLS command.

> --- batch file 1 ---

> `@echo off
> echo Hello World
> echo This batch file does NOT close on exit`

> --- batch file 2 ---

> `@echo off
> echo Hello World
> echo This batch file DOES close on exit
> cls`

#### I've changed DefaultDirName in my script, yet when I run Setup it defaults to the directory I had before.

> At startup Setup looks in the registry to see if the same application was already installed previously, and if so, it will use the directory of the previous installation as the default directory presented to the user in the wizard. If you uninstall the application and run Setup again, it will use the new DefaultDirName setting. If you wish to disable this feature, set UsePreviousAppDir to "no".

#### I have two [Icons] entries with the same Name, but only one of them gets installed.

> Two files can't have the same name, and since shortcuts are files, two shortcuts therefore can't have the same name.

#### Setup isn't waiting for a program executed by a [Run] entry to finish.

> First, make sure that you are not using the "nowait" or "waituntilidle" flags on the [Run] entry. These flags prevent Setup from waiting until the process completely terminates.

> If you aren't using those flags and it still doesn't seem to be waiting for the program to finish, then likely what is happening is that the EXE you're running is spawning some other process and then terminating itself immediately, causing Setup to think the program has finished. This is known to happen with older InstallShield-based installers (to work around it, try using the /SMS switch).

> A simple way to check if a program does that is to run "START /WAIT ProgramName.exe" from the command line, and see if you are returned to the command prompt before the program exits.

#### Some languages are missing on the Select Setup Language dialog, or it doesn't show up at all.

> You are using Non Unicode Inno Setup:

> Beginning with Inno Setup 4.2.2, languages specified in the [Languages] section that cannot be displayed under the active Windows ANSI code page are not listed in the Select Setup Language dialog. For example, Russian text can only be displayed properly if the active code page is 1251; if the user isn't running code page 1251 they will not see Russian as an option.

> On Windows XP, the active code page may be changed by going to Regional and Language Options in Control Panel, and setting Language for non-Unicode programs on the Advanced tab. On Windows 2000, the active code page may be changed by going to Regional Options in Control Panel, and clicking Set default....

> If you are sure you're running in the correct code page and a language still isn't being listed, then most likely `LanguageCodePage` is set incorrectly inside the language's .isl file.

> If you would like to force all languages to be visible regardless of whether they can be displayed properly under the active code page, set the `ShowUndisplayableLanguages` [Setup] section directive (new in Inno Setup 5.1.7).

## Installation Tasks

#### Creating Internet (URL) Shortcuts

> First create a file named, for example, "website.url", and place these lines inside it:

> `[InternetShortcut]
> URL=http://web.site.address/`

> Then add these lines to your script:

> `[Files]
> Source: "website.url"; DestDir: "{app}"
> [Icons]
> Name: "{group}\Visit My Web Site"; Filename: "{app}\website.url"
> `

#### Setting the "Start In" Field on a Shortcut

> Use a WorkingDir parameter on the [Icons] section entry.

#### Creating File Associations

> First set the [Setup] section directive "ChangesAssociations" to "yes". Then create [Registry] entries as shown below.

> `[Registry]
> Root: HKCR; Subkey: ".myp"; ValueType: string; ValueName: ""; ValueData: "MyProgramFile"; Flags: uninsdeletevalue`

> > ".myp" is the extension we're associating. "MyProgramFile" is the internal name for the file type as stored in the registry. Make sure you use a unique name for this so you don't inadvertently overwrite another application's registry key.

> `Root: HKCR; Subkey: "MyProgramFile"; ValueType: string; ValueName: ""; ValueData: "My Program File"; Flags: uninsdeletekey`

> > "My Program File" above is the name for the file type as shown in Explorer.

> `Root: HKCR; Subkey: "MyProgramFile\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\MYPROG.EXE,0"`

> > "DefaultIcon" is the registry key that specifies the filename containing the icon to associate with the file type. ",0" tells Explorer to use the first icon from MYPROG.EXE. (",1" would mean the second icon.)

> `Root: HKCR; Subkey: "MyProgramFile\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\MYPROG.EXE"" ""%1"""`

> > "shell\open\command" is the registry key that specifies the program to execute when a file of the type is double-clicked in Explorer. The surrounding quotes are in the command line so it handles long filenames correctly.

#### Setting Environment Variables

> Environment variables are stored as string values in the registry, so it is possible to manipulate them using the [Registry] section. System-wide environment variables are located at:

> > HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

> User-specific environment variables are located at:

> > HKEY_CURRENT_USER\Environment

#### Setting the "Close on Exit" Box on a Shortcut to an MS-DOS Program

> Inno Setup version 1.3.15 and later includes support for "closeonexit" and "dontcloseonexit" flags in the [Icons] section.

#### Making Backups Before Replacing Files

> Inno Setup does not currently have a specific feature for doing that, but you can make a copy of a file before it is replaced by using a [Files] section entry similar to this:

> `Source: "{app}\MyProg.exe"; DestDir: "{app}\backup"; Flags: external skipifsourcedoesntexist uninsneveruninstall`

#### Installing Different Files Depending on Windows Version

> That can be done via MinVersion and/or OnlyBelowVersion parameters on an entry. See the Common Parameters topic in the documentation for details.

#### Settings Permissions on Files, Directories, or Registry Keys

> Beginning with Inno Setup 4.1.0, the [Dirs], [Files], and [Registry] sections support Permissions parameters for setting permissions on directories, files, and registry keys respectively.

> If you have more advanced needs, take a look at SetACL.

#### My installation needs to do something that Inno Setup apparently doesn't have a feature for.

> See the Knowledge Base article Implementing Custom Functionality.

## How Do I Install...?

#### OCX Files

> The recommended way to install an OCX file is as follows.

> `[Files]
> Source: "ComCtl32.ocx"; DestDir: "{sys}"; CopyMode: alwaysskipifsameorolder; Flags: restartreplace sharedfile regserver`

#### Visual Basic System Files

> See this Knowledge Base article.

#### Visual C++ System Files (e.g. MFC)

> See this Knowledge Base article.

#### COMCTL32.DLL

> If your application requires an updated version of COMCTL32.DLL, you can direct your users to download the COMCTL32 update from Microsoft, or call the COMCTL32 update from your installation by using the following lines:

> `[Files]
> Source: "50comupd.exe"; DestDir: "{tmp}"
> [Code]
> function ShouldInstallComCtlUpdate: Boolean;
> var
> MS, LS: Cardinal;
> begin
> // Only install if the existing comctl32.dll is < 5.80
> Result := False;
> if GetVersionNumbers(ExpandConstant('{sys}\comctl32.dll'), MS, LS) then
> if MS < $00050050 then
> Result := True;
> end;
> [Run]
> Filename: "{tmp}\50comupd.exe"; Parameters: "/r:n /q:1"; Check: ShouldInstallComCtlUpdate`

> Don't try to install COMCTL32.DLL directly using the [Files] section; Microsoft does not allow this, and it's dangerous.

#### BDE (Borland Database Engine)

> See the Knowledge Base article Installing BDE for details on deploying the 32-bit version of BDE using Inno Setup.

#### MDAC, ADO, Jet, etc.

> See this Knowledge Base article.

## Compatibility

#### OS Compatibility

> Currently supported platforms include every Windows release since 2000. No service packs or other OS updates are required on any of the supported platforms.

> The 16-bit version of Inno Setup was discontinued starting with version 1.3. Support for Windows NT 3.51 was discontinued starting with version 3.0. Support for Windows 95, 98, Me, and NT 4.0 was discontinued starting with version 5.5.

#### Administrative Privileges

> A typical Inno Setup installation does not require administrative or "power user" privileges. However, there are exceptions as noted below.

> Things that require administrative privileges:

> - Using "PrivilegesRequired=admin" in the script's [Setup] section. This causes Setup to abort with an error message if the user lacks administrative privileges.
> - Using the "restartreplace" flag in the [Files] section. This flag causes Inno Setup to call the MoveFileEx function, which attempts to write to "HKEY_LOCAL_MACHINE\ SYSTEM\ CurrentControlSet\ Control\ Session Manager". Write access to this key is restricted to Administrators.
> - Writing to any key under HKEY_USERS\.DEFAULT using the [Registry] section. Write access to this key is restricted to Administrators.

> Things that require either administrative or "power user" privileges:

> - Using "PrivilegesRequired=poweruser" in the script's [Setup] section. This causes Setup to abort with an error message if the user lacks either administrative or "power user" privileges.
> - Using the "regserver" flag in the [Files] section. In most cases registering a DLL involves writing to HKEY_CLASSES_ROOT, a privilege not granted to ordinary users.
> - Using the "sharedfile" flag is the [Files] section. This flag causes Inno Setup to create/update a value in "HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ Windows\ CurrentVersion\ SharedDLLs". Ordinary users are not allowed to write to that key.
> - Using the FontInstall parameter in the [Files] section.
> - Writing to any key under HKEY_LOCAL_MACHINE or HKEY_CLASSES_ROOT using the [Registry] section. Ordinary users are not allowed to write to those keys.

> Inno Setup itself does not require write access to the WINNT directory, or any other registry keys not mentioned above.

> What is different when an installation is run by a user without administrative privileges?

> - The registry key for the Add/Remove Programs Control Panel entry is created under HKEY_CURRENT_USER instead of HKEY_LOCAL_MACHINE. Thus, only the user who installed the program will see an Add/Remove Programs entry for it.
> - The "{group}" constant always points to the current user's profile, as opposed to the All Users profile.
> - All "{common...}" constants are equivalent to the "{user...}" constants.
> - The program may be uninstalled by any user. (When an administrator installs a program, only an administrator is allowed to uninstall it.)

## Miscellaneous

#### Are there any limits on how many files, etc. may be included in an installation?

> Inno Setup places no arbitrary limits on how many files, shortcuts, registry entries, etc. that you may include in an installation. However, keep in mind that Setup does need memory for each entry in a script. For example, roughly 120 bytes of memory is needed for each [Files] entry.

> In Inno Setup 3.x and earlier, installations and individual files cannot exceed 2 GB, because it does not use 64-bit arithmetic in most places. This has been addressed in Inno Setup 4.

#### What exactly happens when the user clicks Cancel during an installation?

> When Cancel is clicked, Setup will begin reverting changes it's made so far in the very same manner as the Uninstall program. Thus, a partially installed application isn't left over.