当主安装程序(非常)以静默方式运行时,以非常方式运行子安装程序

时间:2016-07-13 15:42:07

标签: inno-setup

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

Inno Script运行命令:

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

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

"setup location" /VERYSILENT /Install silent

主Inno安装程序安装程序正在静默运行,但是使用UI启动了子setup.exe

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

3 个答案:

答案 0 :(得分:1)

Inno Setup中没有/Install silent参数。

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

请参阅Inno Setup文档中的Setup Command Line Parameters

  

/ SILENT,/ VERYSILENT

     

指示安装程序保持沉默或非常安静。安装程序静默时,不显示向导和后台窗口,但安装进度窗口为。当设置非常安静时,不会显示此安装进度窗口。其他一切都是正常的,例如显示安装过程中的错误消息并启动提示符(如果您没有使用DisableStartupPrompt或上面解释的'/ SP-'命令行选项禁用它)。

     

如果需要重新启动并且未使用'/ NORESTART'命令(见下文)并且安装程序是静默的,它将立即显示重启?消息框。如果它非常安静,它将重新启动而不会询问。

因此,您必须使用/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是标准功能。

答案 1 :(得分:0)

我尝试了这个并且完全无声:

[Run]
Filename: "path\setup.exe"; Parameters:/VERYSILENT; Flags: nowait

without "" in Parameter

希望这会有所帮助

答案 2 :(得分:-1)

我们尝试使用相同的代码通过inno setup进行静默安装

[Run]
Filename: "{app}\{#MyAppExeName}"; Parameters:/VERYSILENT; Flags: nowait

但是仍然可以选择目标文件夹和桌面图标