innosetup[Run][UninstallRun]字段解釋

轉自:https://blog.csdn.net/GYD2780838/article/details/88708492

[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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章