-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathisfaq.html
551 lines (472 loc) · 40.4 KB
/
isfaq.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<!--!
Inno Setup
Copyright (C) 1997-2021 Jordan Russell
Portions by Martijn Laan
For conditions of distribution and use, see LICENSE.TXT.
Inno Setup FAQ contents
Please try to make your changes as consistent as possible with the existing
text and write them in such a way that the information will stay accurate for
many years to come and requires as little maintenance as possible.
When adding a new topic, do not forget to update the list of contents at the
top of the FAQ as well.
Please do NOT submit translations.
-->
<h3>Functionality</h3>
<ul>
<li><a href="#lang">Translating Inno Setup's Text</a></li>
<li><a href="#mbcs">Does it support MBCS (multi-byte character sets)?</a></li>
<li><a href="#msi">Will it support Windows Installer in the future?</a></li>
<li><a href="#setupicon">How do I change the icon of Setup.exe?</a></li>
<li><a href="#conditional">Can Inno Setup do a conditional installation - for example, proceed only if a certain registry key or file exists?</a></li>
<li><a href="#download">Is there a download feature?</a></li>
<li><a href="#silent">Is it possible to do a silent install without using the /SILENT or /VERYSILENT command-line parameters?</a></li>
<li><a href="#dirnamereg">Can Setup use the value of a registry entry as the default directory name?</a></li>
<li><a href="#deluserkeys">Is it possible to delete keys inside every users' HKEY_CURRENT_USER registry hive?</a></li>
<li><a href="#filestodeploy">What system files must I deploy with my application?</a></li>
<li><a href="#updateinstall">How to create an installation that is an "update" or "add-on" to an existing installation?</a></li>
</ul>
<h3>Problems</h3>
<ul>
<li><a href="#errorquotes">Compiler says "Mismatched or misplaced quotes on parameter"</a></li>
<li><a href="#workingdir">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.</a></li>
<li><a href="#appid">When I install a new version of my application without uninstalling the old version first, I get a second entry in Control Panel's <i>Add/Remove Programs</i>.</a></li>
<li><a href="#corrupt">Why is the error message "The setup files are corrupted" displayed on some systems?</a></li>
<li><a href="#noregserver">Setup gives the message "Unable to register the DLL/OCX: DllRegisterServer export not found"</a></li>
<li><a href="#emptydirs">After uninstalling, the directories created during installation still exist.</a></li>
<li><a href="#batchfile">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."</a></li>
<li><a href="#olddir">I've changed DefaultDirName in my script, yet when I run Setup it defaults to the directory I had before.</a></li>
<li><a href="#twoicons">I have two [Icons] entries with the same Name, but only one of them gets installed.</a></li>
<li><a href="#runwait">Setup isn't waiting for programs executed by [Run] entries to finish.</a></li>
<li><a href="#missinglanguages">Some languages are missing on the <i>Select Setup Language</i> dialog, or it doesn't show up at all.</a></li>
<li><a href="#missingmappeddrives">Mapped drives aren't showing up on the <i>Select Destination Location, or cannot be browsed into.</i> wizard page.</a></li>
<li><a href="#custom">My installation needs to do something that Inno Setup apparently doesn't have a feature for.</a></li>
<li><a href="#wildcard">Wildcard matches unexpected extensions.</a></li>
<li><a href="#filesemptydirs">Empty directories are not included when "recursesubdirs" flag is used on a [Files] entry.</a></li>
<li><a href="#filenotreplaced">Setup isn't replacing a particular file.</a></li>
</ul>
<h3>Installation Tasks</h3>
<ul>
<li><a href="#urls">Creating Internet (URL) Shortcuts</a></li>
<li><a href="#startin">Setting the "Start In" Field on a Shortcut</a></li>
<li><a href="#assoc">Creating File Associations</a></li>
<li><a href="#env">Setting Environment Variables</a></li>
<li><a href="#closeonexit">Setting the "Close on Exit" Box on a Shortcut to an MS-DOS Program</a></li>
<li><a href="#backup">Making Backups Before Replacing Files</a></li>
<li><a href="#difffiles">Installing Different Files Depending on Windows Version</a></li>
<li><a href="#perms">Settings Permissions on Files, Directories, or Registry Keys</a></li>
<li><a href="#startup">Starting a program when Windows starts</a></li>
<li><a href="#runbatchfile">Running batch files</a></li>
<li><a href="#mutexsessions">Detecting instances running in any user session with AppMutex</a></li>
<li><a href="#ocx">Installing OCX Files</a></li>
</ul>
<h3>Compatibility</h3>
<ul>
<li><a href="#oscompat">OS Compatibility</a></li>
<li><a href="#ntsecur">Administrative Privileges</a></li>
</ul>
<h3>Miscellaneous</h3>
<ul>
<li><a href="#limits">Are there any limits on how many files, etc. may be included in an installation?</a></li>
<li><a href="#cancel">What exactly happens when the user clicks Cancel during an installation?</a></li>
<li><a href="#uninsttemp">What's this _iu14D2N.tmp file in my TEMP directory?</a></li>
<li><a href="#regreplace">Why does Setup register files when they aren't replaced?</a></li>
<li><a href="#uninstallername">Why has the uninstaller EXE numbers in its name?</a></li>
<li><a href="#redistribute">Am I allowed to redistribute the Inno Setup compiler with my application?</a></li>
</ul>
<hr /><h2>Functionality</h2>
<h4><a name="lang">Translating Inno Setup's Text</a></h4>
<blockquote>
<p>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 documentation for some important tips.</p>
<p>Once you have finished creating the new .isl file, create a [Languages] section to tell the compiler to use it:</p>
<p><tt>
<b>[Languages]</b><br />
<font color="#0078D4">Name</font>: mytrans; <font color="#0078D4">MessagesFile</font>: "compiler:MyTranslation.isl"
</tt></p>
<p>There are many contributed translations available for download on the <a href="https://jrsoftware.org/files/istrans/">Inno Setup Translations</a> page.</p>
<p>Note that the captions of buttons in message boxes can't be translated. These captions are always in the same language as Windows itself. So if the user is running an English edition of Windows, they will see English button captions. This is normal behavior for any application that displays message boxes using the Windows MessageBox() function.</p>
</blockquote>
<h4><a name="mbcs">Does it support MBCS (multi-byte character sets)?</a></h4>
<blockquote>
<p>Yes. It does lead byte checking on all filename and constant parsing, so it does not mistake trail bytes for backslashes ("\") or braces ("{").</p>
</blockquote>
<h4><a name="msi">Will it support Windows Installer in the future?</a></h4>
<blockquote>
<p>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.</p>
</blockquote>
<h4><a name="setupicon">How do I change the icon of Setup.exe?</a></h4>
<blockquote>
<p>The installer's icon may be changed by setting the <tt>SetupIconFile</tt> [Setup] section directive. To set the uninstaller's icon, set <tt>UninstallDisplayIcon</tt>.</p>
</blockquote>
<h4><a name="conditional">Can Inno Setup do a conditional installation - for example, proceed only if a certain registry key or file exists?</a></h4>
<blockquote>
<p>Yes, through the <a href="https://jrsoftware.org/ishelp/index.php?topic=scriptintro">Pascal Scripting feature</a>.</p>
</blockquote>
<h4><a name="download">Is there a download feature?</a></h4>
<blockquote>
<p>Yes, through the Pascal Scripting feature. See the <a href="https://jrsoftware.github.io/issrc/Examples/CodeDownloadFiles.iss">CodeDownloadFiles.iss</a> example script for an example.</p>
</blockquote>
<h4><a name="silent">Is it possible to do a silent install without using the /SILENT or /VERYSILENT command-line parameters?</a></h4>
<blockquote>
<p>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.</p>
</blockquote>
<h4><a name="dirnamereg">Can Setup use the value of a registry entry as the default directory name?</a></h4>
<blockquote>
<p>Yes. Use a {reg:...} constant in DefaultDirName. For example:</p>
<p><tt>
<b>[Setup]</b><br />
<font color="#0078D4">DefaultDirName</font>={reg:HKA\Software\My Program,Path|{autopf}\My Program}<br />
</tt></p>
<p>See the <a href="https://jrsoftware.org/ishelp/index.php?topic=consts">Constants topic</a> in the documentation for more information on {reg:...} constants, and the {autopf} constant.</p>
<p>Also see the <a href="https://jrsoftware.org/ishelp/index.php?topic=admininstallmode">Non Administrative Install Mode topic</a> in the documentation for details on the HKA key value.</p>
</blockquote>
<h4><a name="deluserkeys">Is it possible to delete keys inside every users' HKEY_CURRENT_USER registry hive?</a></h4>
<blockquote>
<p>No. There is no foolproof method of accessing registry keys belonging to other users.</p>
<p>In order to access a given user's registry hive the user's profile must first be loaded, and in order to do that, authentication is necessary. An uninstaller would not know the user's password.</p>
<p>"But couldn't it call RegLoadKey to manually mount the user's registry hive (NTUSER.DAT)?" Without impersonating the user, the user running the uninstaller would need write permission on the user's profile directory. On Windows XP, user profiles can be marked "private", where no one but the user himself can access the files inside it.</p>
<p>And in a roaming profile setup, it's impossible to even know the path in which a given user's profile resides without authenticating first.</p>
<p>To deal with this situation do what other installers do: simply leave the HKCU keys of other users in place.</p>
</blockquote>
<h4><a name="filestodeploy">What system files must I deploy with my application?</a></h4>
<blockquote>
<p>This is primarily dependent on which development tool your application was created with. Check its documentation.</p>
<p>If you determine that your application depends on a particular Microsoft DLL that doesn't come preinstalled with Windows then first of all, <b>do <u>not</u> deploy DLLs out of your own Windows directory</b>. Files in your own Windows directory are often tailored for your specific version of Windows, and will not work on other versions of Windows -- or worse (see <a href="#not">below</a>). This is especially true when you're running the very latest version of Windows.</p>
<p>Instead, search for versions of the DLL on Microsoft's web site that are deemed "redistributable". (<a href="http://www.microsoft.com/downloads/">http://www.microsoft.com/downloads/</a> is a good place to start.) Such versions are normally safe to install on any Windows version (but check the README files to be sure).</p>
<p>If nothing turns up, then probably you aren't allowed to individually deploy the DLL in question.</p>
</blockquote>
<h4><a name="updateinstall">How to create an installation that is an "update" or "add-on" to an existing installation?</a></h4>
<blockquote>
<p>When deploying an installation that is an "update" (or "add-on") to an existing installation, you probably want the following criteria to be met:</p>
<ol>
<li>The update must be installed to the same directory as the original application.</li>
<li>Any new files installed by the update must be removed when the original application is uninstalled.</li>
<li>The update should not create a new entry in the <i>Add/Remove Programs</i> list, or alter the original application's entry. Nor should the application name displayed by the uninstaller change.</li>
</ol>
<p>1 and 2 may be achieved by giving your update installation the same <tt>AppId</tt> setting as the original application. (If you never set <tt>AppId</tt> in the original application, then set <tt>AppId</tt> to the value of <tt>AppName</tt> used in the original application.) This, when combined with <tt>UsePreviousAppDir=yes</tt> (the default setting), will cause the update installation to default to the same directory as the original application, and share the same uninstall log file (unins???.dat). Also see the <a href="https://jrsoftware.org/ishelp/index.php?topic=sameappnotes">Same Application topic</a> in the documentation for details.</p>
<p>3 may be achieved by setting <tt>CreateUninstallRegKey=no</tt> and <tt>UpdateUninstallLogAppName=no</tt>.</p>
</blockquote>
<hr /><h2>Problems</h2>
<h4><a name="errorquotes">Compiler says "Mismatched or misplaced quotes on parameter"</a></h4>
<blockquote>
<p>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 documentation for more information.</p>
</blockquote>
<h4><a name="workingdir">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.</a></h4>
<blockquote>
<p>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.</p>
<p>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: <tt>ExtractFilePath(ParamStr(0))</tt>. To get the full path of a file named "File.txt" in the application directory, use: <tt>ExtractFilePath(ParamStr(0)) + 'File.txt'</tt>.</p>
<p>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.</p>
</blockquote>
<h4><a name="corrupt">Why is the error message "The setup files are corrupted" displayed on some systems?</a></h4>
<blockquote>
<p>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.</p>
<p>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.</p>
<p>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.</p>
</blockquote>
<h4><a name="appid">When I install a new version of my application without uninstalling the old version first, I get a second entry in Control Panel's <i>Add/Remove Programs</i>.</a></h4>
<blockquote>
<p>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 <i>Add/Remove Programs</i>. Additionally, a new uninstall log file (unins???.dat) will be created. The obvious solution for this is to not change AppId or AppName.</p>
<p>If you must change AppName in a new version, set AppId to the value of AppId or AppName from the previous version.</p>
</blockquote>
<h4><a name="noregserver">Setup gives the message "Unable to register the DLL/OCX: DllRegisterServer export not found"</a></h4>
<blockquote>
<p>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.</p>
</blockquote>
<h4><a name="emptydirs">After uninstalling, the directories created during installation still exist.</a></h4>
<blockquote>
<p>There are several reasons why a directory may not be removed:</p>
<ul>
<li>It already existed prior to installation. By default, the uninstaller plays it safe and doesn't remove directories that the installer didn't create.</li>
<li>It contains files or subdirectories. Use [UninstallDelete] if you need the uninstaller to delete additional files/directories.</li>
<li>A running process has the directory as its current directory.</li>
</ul>
</blockquote>
<h4><a name="batchfile">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."</a></h4>
<blockquote>
<p>From Tim Rude:<br />
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.</p>
<p><i>--- batch file 1 ---</i></p>
<p><tt>
@echo off<br />
echo Hello World<br />
echo This batch file does NOT close on exit
</tt></p>
<p><i>--- batch file 2 ---</i></p>
<p><tt>
@echo off<br />
echo Hello World<br />
echo This batch file DOES close on exit<br />
cls
</tt></p>
</blockquote>
<h4><a name="olddir">I've changed DefaultDirName in my script, yet when I run Setup it defaults to the directory I had before.</a></h4>
<blockquote>
<p>At startup Setup looks in the registry to see if the <a href="https://jrsoftware.org/ishelp/index.php?topic=sameappnotes">same application</a> 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 <a href="https://jrsoftware.org/ishelp/index.php?topic=setup_usepreviousappdir">UsePreviousAppDir</a> to "no".</p>
</blockquote>
<h4><a name="twoicons">I have two [Icons] entries with the same Name, but only one of them gets installed.</a></h4>
<blockquote>
<p>Two files can't have the same name, and since shortcuts are files, two shortcuts therefore can't have the same name.</p>
</blockquote>
<h4><a name="runwait">Setup isn't waiting for a program executed by a [Run] entry to finish.</a></h4>
<blockquote>
<p>First, make sure that you are <i>not</i> using the "nowait" or "waituntilidle" flags on the [Run] entry. These flags prevent Setup from waiting until the process completely terminates.</p>
<p>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 <a href="http://www.installshield.com/news/newsletter/0206-articles/LaunchIS5Setup.asp">/SMS switch</a>).</p>
<p>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.</p>
</blockquote>
<h4><a name="missinglanguages">Some languages are missing on the <i>Select Setup Language</i> dialog, or it doesn't show up at all even though I've added multiple languages.</a></h4>
<blockquote>
<p>You are using an old Non Unicode version of Inno Setup.</p>
</blockquote>
<h4><a name="missingmappeddrives">Mapped drives aren't showing up on the <i>Select Destination Location</i> wizard page, or cannot be browsed into.</a></h4>
<blockquote>
<p>Your installation requires administrative privileges and is running elevated:</li>
<p>Mapped drives are not available (by default) to any elevated application. This was introduced in Windows Vista.</p>
<p>There is an <a href="https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/ee844140(v=ws.10)">option</a> to make them available for same user elevation, but this won't help the situation when run from a LUA where the user changes.</p>
</blockquote>
<h4><a name="custom">My installation needs to do something that Inno Setup apparently doesn't have a feature for.</a></h4>
<blockquote>
<p>Use the <a href="https://jrsoftware.org/ishelp/index.php?topic=scriptintro">Pascal Scripting feature</a> or the [Run] section:</p>
<p>The [Run] section is an oft overlooked yet simple method of performing custom installation tasks. First, write a small program in the development tool of your choice (preferably one that creates stand-alone EXEs, such as Delphi) that performs the desired task, and copy its EXE to your script directory. Next, place an entry in the [Files] script section telling Setup to copy the EXE to the install's temporary directory ("{tmp}"):</p>
<p><tt>
<b>[Files]</b><br />
<font color="#0078D4">Source</font>: "ModifyAutoexec.exe"; <font color="#0078D4">DestDir</font>: "{tmp}"</tt></p>
<p>Then add a [Run] section entry, telling Setup to execute the EXE after all other installation steps:</p>
<p><tt>
<b>[Run]</b><br />
<font color="#0078D4">Filename</font>: "{tmp}\ModifyAutoexec.exe"</tt></p>
<p>If the program needs additional information, such as the value of the "{app}" constant, you could pass it via a command line parameter, i.e.:</p>
<p><tt>
<b>[Run]</b><br />
<font color="#0078D4">Filename</font>: "{tmp}\ModifyAutoexec.exe"; <font color="#0078D4">Parameters</font>: """{app}"""</tt></p>
<p>You could alternatively incorporate the installation task into your application's main EXE and have it perform the task when called with a special command line parameter. For example:</p>
<p><tt>
<b>[Run]</b><br />
<font color="#0078D4">Filename</font>: "{app}\MyProgram.exe"; <font color="#0078D4">Parameters</font>: "/DoTheTask"</tt></p>
</blockquote>
<h4><a name="wildcard">Wildcard matches unexpected extensions.</a></h4>
<blockquote>
<p>If the following wildcard is used in a [Files] section entry:</p>
<p><tt>
<b>[Files]</b><br />
<font color="#0078D4">Source</font>: "*.htm"; <font color="#0078D4">DestDir</font>: "{app}"</tt></p>
<p>you may find that it matches not only files with an .htm extension, but also files with an .html extension.</p>
<p>This happens because in Windows, wildcards match both long filenames and 8.3 aliases ("short filenames"). By default, a file named "webpage.html" will have the 8.3 alias "WEBPAG~1.HTM"; hence, <tt>*.htm</tt> will match the file.</p>
<p>To avoid this, add an <tt>Excludes</tt> parameter to explicitly filter out files with an .html extension:</p>
<p><tt>
<b>[Files]</b><br />
<font color="#0078D4">Source</font>: "*.htm"; <font color="#0078D4">Excludes</font>: "*.html"; <font color="#0078D4">DestDir</font>: "{app}"</tt></p>
</blockquote>
<h4><a name="filesemptydirs">Empty directories are not included when "recursesubdirs" flag is used on a [Files] entry.</a></h4>
<blockquote>
<p>Add the <tt>createallsubdirs</tt> flag to your [Files] section entry, and the empty directories will be created at install time.</p>
<p>The [Dirs] section may also be used to create empty directories.</p>
</blockquote>
<h4><a name="filenotreplaced">Setup isn't replacing a particular file.</a></h4>
<blockquote>
<p>Compare the version numbers on the existing file and the new file by right-clicking them in Windows Explorer and selecting <i>Properties</i>. By default, Inno Setup will not replace an existing file unless the existing file has no version info or has a lower version number.</p>
<p>The binary version numbers of files are what Inno Setup actually compares and the <a href="https://jrsoftware.org/ishelp/index.php?topic=setupcmdline&anchor=LOG">/LOG</a> switch can be handy here. The log will show the binary version numbers of files and why certain files were not replaced.</p>
<p>If you want to force a file to be replaced regardless of its version number, add the <tt>ignoreversion</tt> flag to the [Files] section entry. This flag should only be used on files private to your application, <b>never</b> on shared system files.</p>
</blockquote>
<hr /><h2>Installation Tasks</h2>
<h4><a name="urls">Creating Internet (URL) Shortcuts</a></h4>
<blockquote>
<p>First create a file named, for example, "website.url", and place these lines inside it:</p>
<p><tt>[InternetShortcut]<br />
URL=http://web.site.address/
</tt></p>
<p>Then add these lines to your script:</p>
<p><tt>
<b>[Files]</b><br />
<font color="#0078D4">Source</font>: "website.url"; <font color="#0078D4">DestDir</font>: "{app}"<br />
<br />
<b>[Icons]</b><br />
<font color="#0078D4">Name</font>: "{group}\Visit My Web Site"; <font color="#0078D4">Filename</font>: "{app}\website.url"<br />
</tt></p>
</blockquote>
<h4><a name="startin">Setting the "Start In" Field on a Shortcut</a></h4>
<blockquote>
<p>Use a WorkingDir parameter on the [Icons] section entry.</p>
</blockquote>
<h4><a name="assoc">Creating File Associations</a></h4>
<blockquote>
<p>First set the [Setup] section directive "ChangesAssociations" to "yes". Then create 5 [Registry] entries as shown below to create a file association.</p>
<p><tt>
<b>[Registry]</b><br />
<font color="#0078D4">Root</font>: HKA; <font color="#0078D4">Subkey</font>: "Software\Classes\.myp\OpenWithProgids"; <font color="#0078D4">ValueType</font>: string; <font color="#0078D4">ValueName</font>: "MyProgramFile.myp"; <font color="#0078D4">ValueData</font>: ""; Flags: uninsdeletevalue
</tt></p>
<blockquote>
".myp" is the extension we're associating. "MyProgramFile.myp" 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.
</blockquote>
<p><tt>
<font color="#0078D4">Root</font>: HKA; <font color="#0078D4">Subkey</font>: "Software\Classes\MyProgramFile.myp"; <font color="#0078D4">ValueType</font>: string; <font color="#0078D4">ValueName</font>: ""; <font color="#0078D4">ValueData</font>: "My Program File"; <font color="#0078D4">Flags</font>: uninsdeletekey
</tt></p>
<blockquote>
"My Program File" above is the name for the file type as shown in Explorer.
</blockquote>
<p><tt>
<font color="#0078D4">Root</font>: HKA; <font color="#0078D4">Subkey</font>: "Software\Classes\MyProgramFile.myp\DefaultIcon"; <font color="#0078D4">ValueType</font>: string; <font color="#0078D4">ValueName</font>: ""; <font color="#0078D4">ValueData</font>: "{app}\MyProg.exe,0"
</tt></p>
<blockquote>
"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.)
</blockquote>
<p><tt>
<font color="#0078D4">Root</font>: HKA; <font color="#0078D4">Subkey</font>: "Software\Classes\MyProgramFile.myp\shell\open\command"; <font color="#0078D4">ValueType</font>: string; <font color="#0078D4">ValueName</font>: ""; <font color="#0078D4">ValueData</font>: """{app}\MyProg.exe"" ""%1"""
</tt></p>
<blockquote>
"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.
</blockquote>
<p><tt>
<font color="#0078D4">Root</font>: HKA; <font color="#0078D4">Subkey</font>: "Software\Classes\Applications\MyProg.exe\SupportedTypes"; <font color="#0078D4">ValueType</font>: string; <font color="#0078D4">ValueName</font>: ".myp"; <font color="#0078D4">ValueData</font>: ""
</tt></p>
<p>Also see the <a href="https://jrsoftware.org/ishelp/index.php?topic=admininstallmode">Non Administrative Install Mode topic</a> in the documentation for details on the HKA key value.</p>
</blockquote>
<h4><a name="env">Setting Environment Variables</a></h4>
<blockquote>
<p>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:</p>
<blockquote>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment</blockquote>
<p>User-specific environment variables are located at:</p>
<blockquote>HKEY_CURRENT_USER\Environment</blockquote>
</blockquote>
<h4><a name="closeonexit">Setting the "Close on Exit" Box on a Shortcut to an MS-DOS Program</a></h4>
<blockquote>
<p>Use the "closeonexit" and "dontcloseonexit" flags in the [Icons] section.</p>
</blockquote>
<h4><a name="backup">Making Backups Before Replacing Files</a></h4>
<blockquote>
<p>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:</p>
<p><tt><font color="#0078D4">Source</font>: "{app}\MyProg.exe"; <font color="#0078D4">DestDir</font>: "{app}\backup"; <font color="#0078D4">Flags</font>: external skipifsourcedoesntexist uninsneveruninstall</tt></p>
</blockquote>
<h4><a name="difffiles">Installing Different Files Depending on Windows Version</a></h4>
<blockquote>
<p>This can be done via MinVersion and/or OnlyBelowVersion parameters on an entry. See the <a href="https://jrsoftware.org/ishelp/index.php?topic=commonparams">Common Parameters topic</a> in the documentation for details.</p>
</blockquote>
<h4><a name="perms">Settings Permissions on Files, Directories, or Registry Keys</a></h4>
<blockquote>
<p>The [Dirs], [Files], and [Registry] sections support Permissions parameters for setting permissions on directories, files, and registry keys respectively.</p>
<p>If you have more advanced needs, take a look at <a href="https://helgeklein.com/setacl/">SetACL</a>.</p>
</blockquote>
<h4><a name="startup">Starting a program when Windows starts</a></h4>
<blockquote>
<p>There are two different ways to accomplish this:</p>
<ol>
<li>Either create a shortcut in the Startup group:<br /><br />
<tt>
<b>[Icons]</b><br />
<font color="#0078D4">Name</font>: "{autostartup}\My Program"; <font color="#0078D4">Filename</font>: "{app}\MyProg.exe"</tt>
</li>
<li>Or create a value in the Run key of the registry:<br /><br />
<tt>
<b>[Registry]</b><br />
<font color="#0078D4">Root</font>: HKA; <font color="#0078D4">Subkey</font>: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; <font color="#0078D4">ValueType</font>: string; <font color="#0078D4">ValueName</font>: "MyProg"; <font color="#0078D4">ValueData</font>: """{app}\MyProg.exe"""; <font color="#0078D4">Flags</font>: uninsdeletevalue</tt>
</li>
</ol>
<p>See the <a href="https://jrsoftware.org/ishelp/index.php?topic=consts">Constants topic</a> in the documentation for more information on the {autostartup} constant.</p>
<p>Also see the <a href="https://jrsoftware.org/ishelp/index.php?topic=admininstallmode">Non Administrative Install Mode topic</a> in the documentation for details on the HKA key value.</p>
</blockquote>
<h4><a name="runbatchfile">Running batch files</a></h4>
<blockquote>
<p>You may run a batch file by specifying the filename directly in the <tt>Filename</tt> parameter of a [Run] section entry:</p>
<p><tt>
<b>[Run]</b><br />
<font color="#0078D4">Filename</font>: "{app}\YourBatchFile.bat"</tt></p>
</blockquote>
<h4><a name="mutexsessions">Detecting instances running in any user session with AppMutex</a></h4>
<blockquote>
<p><tt>AppMutex</tt> by default will not find mutexes created in user sessions other than the one Setup/Uninstall is running under. This is because each user session has its own kernel namespace.</p>
<p>To detect mutexes created in other sessions, your application must create two mutexes: one with a <tt>Global\</tt> prefix and the other without.</p>
<p>Mutexes with the <tt>Global\</tt> prefix are accessible from any user session. A like-named mutex must also be created in the session namespace (i.e. without the <tt>Global\</tt> prefix) in case the creation of the Global mutex failed due to security restrictions.</p>
<p>Additionally, a special security descriptor must be passed in each of the CreateMutex() calls to ensure the mutex is accessible by different users.</p>
<p>Here is an example of how to create the two mutexes in Delphi:</p>
<p><tt><font color="#0078D4">procedure</font> CreateMutexes(<font color="#0078D4">const</font> MutexName: String);<br />
<font color="#339933">{ Creates the two mutexes checked for by the installer/uninstaller to see if<br />
the program is still running. }</font><br />
<font color="#0078D4">const</font><br />
SECURITY_DESCRIPTOR_REVISION = <font color="#E5885E">1</font>;<br />
<font color="#0078D4">var</font><br />
SecurityDesc: TSecurityDescriptor;<br />
SecurityAttr: TSecurityAttributes;<br />
<font color="#0078D4">begin</font><br />
<font color="#339933">{ By default created mutexes are accessible only by the user running<br />
the process. We need our mutexes to be accessible to all users, so<br />
that the mutex detection can work across user sessions. To do this<br />
we use a security descriptor with a null DACL. }</font><br />
InitializeSecurityDescriptor(@SecurityDesc, SECURITY_DESCRIPTOR_REVISION);<br />
SetSecurityDescriptorDacl(@SecurityDesc, True, <font color="#0078D4">nil</font>, False);<br />
SecurityAttr.nLength := SizeOf(SecurityAttr);<br />
SecurityAttr.lpSecurityDescriptor := @SecurityDesc;<br />
SecurityAttr.bInheritHandle := False;<br />
CreateMutex(@SecurityAttr, False, PChar(MutexName));<br />
CreateMutex(@SecurityAttr, False, PChar(<font color="#E5885E">'Global\'</font> + MutexName));<br />
<font color="#0078D4">end</font>;<br />
<br />
...<br />
<br />
<font color="#0078D4">begin</font><br />
CreateMutexes(<font color="#E5885E">'<b>YourMutexNameGoesHere</b>'</font>);<br />
<font color="#0078D4">end</font>;</tt></p>
<p>In your script, set <tt>AppMutex</tt> as follows:</p>
<p><tt>
<b>[Setup]</b><br />
<font color="#0078D4">AppMutex</font>=<b>YourMutexNameGoesHere</b>,Global\<b>YourMutexNameGoesHere</b></tt></p>
</blockquote>
<h4><a name="ocx">Installing OCX Files</a></h4>
<blockquote>
<p>The recommended way to install an OCX file is as follows.</p>
<p><tt>
<b>[Files]</b><br />
<font color="#0078D4">Source</font>: "ComCtl32.ocx"; <font color="#0078D4">DestDir</font>: "{sys}"; <font color="#0078D4">Flags</font>: restartreplace sharedfile regserver
</tt></p>
</blockquote>
<hr /><h2>Compatibility</h2>
<h4><a name="oscompat">OS Compatibility</a></h4>
<blockquote>
<p>See the <a href="https://jrsoftware.org/isinfo.php#features">About page</a>.</p>
</blockquote>
<h4><a name="ntsecur">Administrative Privileges</a></h4>
<blockquote>
<p>A typical Inno Setup installation does not require administrative privileges. However, there are exceptions as noted below.</p>
<p>Things that require administrative privileges:</p>
<ul>
<li>Using "PrivilegesRequired=admin" in the script's [Setup] section. This causes Setup to abort with an error message if the user lacks administrative privileges.</li>
<li>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.</li>
<li>Writing to any key under HKEY_USERS\.DEFAULT using the [Registry] section. Write access to this key is restricted to Administrators.</li>
<li>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.</li>
<li>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.</li>
<li>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.</li>
</ul>
<p>Inno Setup itself does not require write access to the Windows directory, or any other registry key not mentioned above.</p>
<p>What is different when an installation is run by a user <i>without</i> administrative privileges?</p>
<ul>
<li>The registry key for the <i>Add/Remove Programs</i> 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 <i>Add/Remove Programs</i> entry for it.</li>
<li>The "{group}" constant always points to the current user's profile, as opposed to the All Users profile.</li>
<li>The program may be uninstalled by any user. (When an administrator installs a program, only an administrator is allowed to uninstall it.)</li>
</ul>
<p>Also see the <a href="https://jrsoftware.org/ishelp/index.php?topic=admininstallmode">Non Administrative Install Mode topic</a> in the documentation for details.</p>
</blockquote>
<hr /><h2>Miscellaneous</h2>
<h4><a name="limits">Are there any limits on how many files, etc. may be included in an installation?</a></h4>
<blockquote>
<p>Inno Setup places no arbitrary limits on how many files, shortcuts, registry entries, etc. that you may include in an installation.</p>
</blockquote>
<h4><a name="cancel">What exactly happens when the user clicks Cancel during an installation?</a></h4>
<blockquote>
<p>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.</p>
</blockquote>
<h4><a name="uninsttemp">What's this _iu14D2N.tmp file in my TEMP directory?</a></h4>
<blockquote>
<p>A temporary file with a name like "_iu14D2N.tmp" is created when you uninstall a program that used Inno Setup as its installer. The reason the file remains in the directory after the uninstall process has completed is that Windows does not allow running executables to delete themselves. So what it does is schedule the file to be deleted automatically the next time your computer is restarted. If you don't want to wait until then, it is perfectly safe to delete the file manually, provided no uninstallers are currently running.</p>
<p>Note that this behavior is not unique to Inno Setup.</p>
</blockquote>
<h4><a name="regreplace">Why does Setup register files when they aren't replaced?</a></h4>
<blockquote>
<p>When a file has the <tt>regserver</tt> flag, Setup will try to register the file even if it wasn't replaced during the installation (e.g., if the existing file was a newer version).</p>
<p>This behavior might on the surface seem superfluous, but in fact it's quite necessary. Whoever installed the file in the first place may not have registered it. Or, the existing file may somehow have gotten unregistered without being deleted. If Setup only registered files that were replaced, then in both of these cases the file would remain in an unregistered state at the end of installation, and your application wouldn't work.</p>
</blockquote>
<h4><a name="uninstallername">Why has the uninstaller EXE numbers in its name?</a></h4>
<blockquote>
<p>Frequently new users wonder why the uninstaller EXE has numbers in its name (e.g. unins000.exe).</p>
<p>It is because Inno Setup allows multiple applications to be installed to the same directory. When that happens, the first application's uninstaller is named unins000.exe, the second application's uninstaller is named unins001.exe, and so on. If a fixed name were used, then it would only be possible to uninstall the most recently installed application.</p>
</blockquote>
<h4><a name="redistribute">Am I allowed to redistribute the Inno Setup compiler with my application?</a></h4>
<blockquote>
<p>If your application needs to create installations on the fly, it is permissible to deploy the files for the Inno Setup compiler along with it, provided the terms of the Inno Setup <a href="https://jrsoftware.org/files/is/license.txt">license</a> are followed.</p>
</blockquote>