innosetup[Run][UninstallRun]字段解释

[Run] & [UninstallRun] 段

[Run] 段是可选的,用来指定程序完成安装后、在安装程序显示最终对话框之前要执行的程序数,[UninstallRun] 段也可样是可选的,用来指定在卸载第一步要执行的程序数。除在下面有注释的外,两个段用相同的语法。

程序按它们在脚本中的出现顺序执行。按默认,当处理 [Run]/[UninstallRun] 段条目时,安装程序/卸载程序将在处理下一个任务之前等待,直到程序终止。除非使用了 nowait,shellexec 或 waituntilidle 标记。

注意,按默认,如果 [Run] 段队列文件中的一个正在执行的程序要在下一次重新启动后替换 (通过调用 MoveFileEx 或通过修改 wininit.ini),安装程序将进行侦测,并在安装结束后提示用户重新启动电脑。如果你不想这么做,设置 RestartIfNeededByRun 指令为 no。

下面是 [Run] 段的一个示例:

[Run]
Filename: "{app}\INIT.EXE"; Parameters: "/x"
Filename: "{app}\README.TXT"; Description: "查看自述文件"; Flags: postinstall shellexec skipifsilent
Filename: "{app}\MYPROG.EXE"; Description: "运行应用程序"; Flags: postinstall nowait skipifsilent unchecked

下列是所支持的参数列表:

Filename  (必需的)

要执行的程序,或要打开的文件/文件夹。如果 Filename 不是一个可执行文件 (.exe 或 .com) 或批处理文件 (.bat 或 .cmd),你必须在条目中使用该 shellexec 标记。这个参数可以包含常量。

示例:

Filename: "{app}\INIT.EXE"

Description

仅在 [Run] 段有效。这是条目的描述,可以包含常量。这个描述用于带 postinstall 标记的条目。如果条目的描述未指定,安装程序将使用一个默认描述。这个描述根据条目的类型(normal 或 shellexec)。

示例:

Description: "查看自述文件"

Parameters

程序的可选命令行参数,可以包含常量。

示例:

Parameters: "/x"

WorkingDir

默认初始化为当前目录启动。如果这个参数未指定或是空白的,它使用 Filename 参数中的目录。如果 Filename 不包含路径,它将使用默认目录。这个参数可以包含常量。

示例:

WorkingDir: "{app}"

StatusMsg

仅在 [Run] 段有效。确定程序执行时显示在向导页的消息。如果这个参数未指定可是空白的,将使用默认的消息“正在完成安装...”。这个参数可以包含常量。

示例:

StatusMsg: "正在安装 BDE..."

RunOnceId

仅在 [UninstallRun] 段有效。如果已经安装了相同的应用程序,卸载日志文件中的“run”条目将被复制一个副本。通过分配一个字符给 RunOnceId,可以确保在卸载期间特殊的 [UninstallRun] 条目只执行一次。例如,如果卸载日志中有两个或更多“run”条目用“DelService”的 RunOnceId 设置,只执行最后一个用“DelService”的 RunOnceId 设置的条目;其它的将被忽略。注意 RunOnceId 比校是区分大小写的。

示例:

RunOnceId: "DelService"

Verb

Specifies the action to be performed on the file. Must be combined with the shellexec flag. Commonly available verbs include "open" and "print". If this parameter is not specified or is blank, the default verb for the file type will be used (typically "open")。

示例:

Verb: "print"

Flags

这个参数是额外选项设置。多个选项可以使用空格隔开。支持下面的选项:

32bit

Causes the {sys} constant to map to the 32-bit System directory when used in the Filename and WorkingDir parameters. This is the default behavior in a 32-bit mode install。

这个标记不能与 shellexec 组合使用。

64bit

Causes the {sys} constant to map to the 64-bit System directory when used in the Filename and WorkingDir parameters. This is the default behavior in a 64-bit mode install。

This flag can only be used when Setup is running on 64-bit Windows, otherwise an error will occur. On an installation supporting both 32- and 64-bit architectures, it is possible to avoid the error by adding a Check: IsWin64 parameter, which will cause the entry to be silently skipped when running on 32-bit Windows。

这个标记不能与 shellexec 组合使用。

hidewizard

如果指定了这个标记,向导将在程序运行期间隐藏。

nowait

如果指定了这个标记,它将在处理下一个 [Run] 条目前或完成安装前不等待进程执行完成。不能与 waituntilidle 或 waituntilterminated 组合使用。

postinstall

仅在 [Run] 段有效。告诉安装程序在安装完成向导页创建一个选择框,用户可以选中或不选中这个选择框从而决定是否处理这个条目。以前这个标记调用 showcheckbox。

如果安装程序已经重新启动了用户的电脑 (安装了一个带 restartreplace 标记的文件或如果 [Setup] 段的 AlwaysRestart 指令是 yes 引起的),选择框没有机会出现,因此这些条目不会被处理。

[Files] 段条目中的 isreadme 标记现在已被废弃。如果编译器带 isreadme 标记的条目,它将从 [Files] 段条目中忽略这个标记,并在 [Run] 段条目列表的开头插入一个生成的 [Run] 条目。这相生成的 [Run] 段条目运行自述文件,并带有 shellexec,skipifdoesntexist,postinstall 和 skipifsilent 标记。

runascurrentuser

如果指定了这个标记,the spawned process will inherit Setup/Uninstall's user credentials (typically, full administrative privileges)。

This is the default behavior when the postinstall flag is not used。

这个标记不能与 runasoriginaluser 组合使用。

runasoriginaluser

仅在 [Run] 段有效。If this flag is specified and the system is running Windows Vista or later, the spawned process will execute with the (normally non-elevated) credentials of the user that started Setup initially (i.e., the "pre-UAC dialog" credentials)。

This is the default behavior when the postinstall flag is used。

If a user launches Setup by right-clicking its EXE file and selecting "Run as administrator", then this flag, unfortunately, will have no effect, because Setup has no opportunity to run any code with the original user credentials. The same is true if Setup is launched from an already-elevated process. Note, however, that this is not an Inno Setup-specific limitation; Windows Installer-based installers cannot return to the original user credentials either in such cases。

这个标记不能与 runascurrentuser 组合使用。

runhidden

如果指定了这个标记,它将在隐藏窗口中运行程序。请在执行一个要提示用户输入的程序中不要使用这个标记。

runmaximized

如果指定了这个标记,将在最大化窗口运行程序或文档。

runminimized

如果指定了这个标记,将在最小化窗口运行程序或文档。

shellexec

如果 Filename 不是一个直接可执行文件 (.exe 或 .com 文件),这个标记是必需的。当设置这个标记时,Filename 可以是一个文件夹或任何已注册的文件类型 -- 包括 .hlp,.doc 等。该文件将用用户系统中与这个文件类型关联的应用程序打开,与在资源管理器双击文件的方法是相同的。

按默认,当使用 shellexec 标记时,将不等待,直到生成的进程终止。
如果你需要,你必须添加标记 waituntilterminated。注意,如果新进程未生成,它不能执行也将不等待 -- 例如,文件指定指定为一个文件夹。

skipifdoesntexist

如果这个标记在 [Run] 段中指定,如果 Filename 不存在,安装程序不显示错误消息。

如果这个标记在 [UninstallRun] 段中指定,如果 Filename 不存在,卸载程序不显示“一些元素不能删除”的警告。

在使用这个标记时, Filename 必须是一个绝对路径。

skipifnotsilent

仅在 [Run] 段有效。告诉安装程序如果安装程序未在后台运行则跳过这个条目。

skipifsilent

仅在 [Run] 段有效。告诉安装程序如果安装程序在后台运行则跳过这个条目。

unchecked

仅在 [Run] 段有效。告诉安装程序初始为不选中选择框。如果用户希望处理这个条目,可以通过选取选择框执行。如果 postinstall 标记未同时指定,这个标记被忽略。

waituntilidle

如果指定了这个标记,它将在未输入期间等待,直到进程等待用户输入,而不是等待进程终止。(调用 WaitForInputIdle Win32 函数。) 不能与 nowait 或 waituntilterminated 组合使用。

waituntilterminated

如果指定这个标记,将等待到进程完全终止。注意这是一个默认动作 (也就是你不需要指定这个标记),除非你使用了 shellexec 标记,在这种情况下,如果你要等待,需要指定这个标记。不能与 nowait 或 waituntilidle 组合使用。

示例:

Flags: postinstall nowait skipifsilent

你可能感兴趣的:(innosetup[Run][UninstallRun]字段解释)