gpt4 book ai didi

inno-setup - 当主安装程序(非常)静默运行时,子安装程序(非常)静默运行

转载 作者:行者123 更新时间:2023-12-02 06:08:45 30 4
gpt4 key购买 nike

我有一个 Inno Script istaller 在其中运行子 setup.exe 。当向主安装程序提供静默安装参数时,我必须向 setup.exe 提供静默安装参数。

Inno脚本运行命令:

[Run]
Filename: "setup.exe"; Parameters:"/Install silent"; Flags: nowait

我在命令提示符中给出了静默安装参数,如下所示,

"setup location" /VERYSILENT /Install silent

主 Inno Setup 安装程序正在静默运行,但子 setup.exe 通过 UI 启动。

如何从 Inno Setup 脚本文件中的命令提示符获取静默安装参数?请帮我解决这个问题。

最佳答案

Inno Setup 中没有 /Install Silent 参数。

/silent/verysilent/silent 仍显示安装进度窗口,而 /verysilent 则不显示。

参见Setup Command Line Parameters在 Inno Setup 文档中:

/SILENT, /VERYSILENT

Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but the installation progress window is. When a setup is very silent this installation progress window is not displayed. Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you haven't disabled it with DisableStartupPrompt or the '/SP-' command line option explained above).

If a restart is necessary and the '/NORESTART' command isn't used (see below) and Setup is silent, it will display a Reboot now? message box. If it's very silent it will reboot without asking.

<小时/>

因此,您必须使用 /verysilent 标志运行子安装程序以避免任何 GUI。

[Run]
Filename: "setup.exe"; Parameters: "/verysilent"; Flags: nowait
<小时/>

但是,如果您想静默运行子安装程序,只有父安装程序静默运行时,您可以这样做:

[Run]
Filename: "setup.exe"; Parameters: "{code:SilentParameter}"; Flags: nowait

[Code]

function WizardVerySilent: Boolean;
var
i: Integer;
begin
Result := False;
for i := 1 to ParamCount do
if CompareText(ParamStr(i), '/verysilent') = 0 then
begin
Result := True;
Break;
end;
end;

function SilentParameter(Param: string): string;
begin
if WizardSilent then
begin
if WizardVerySilent then
Result := '/verysilent'
else
Result := '/silent';
end;
end;

区分静音和非常静音安装的代码受到 How to detect whether the setup runs in very silent mode? 的启发。 WizardSilent是一个标准函数。

关于inno-setup - 当主安装程序(非常)静默运行时,子安装程序(非常)静默运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38356196/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com