运行 使用 Inno Setup 静默安装,没有任何 Next 按钮或 Install 按钮

Run installation using Inno Setup silently without any Next button or Install button

我希望我的安装应该是静默的,用户不会单击任何 NextInstall 按钮。我仍然试图禁用所有页面,我得到了 "Ready to Install" 页面。我想避开这个安装页面。

对于 运行 Inno Setup 中内置的安装程序,无需与用户进行任何交互,甚至无需任何 window,请使用 /SILENT or /VERYSILENT command-line parameters:

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).


您也可以考虑使用 /SUPPRESSMSGBOXES 参数。


如果你想让你的安装程序 运行 "silently" 没有任何额外的 command-line 开关,你可以:

  • 使用 ShouldSkipPage event function 跳过大部分页面。
  • 使用计时器跳过 "Ready to Install" 页面(无法使用 ShouldSkipPage 跳过)。您可以使用
  • 中所示的技术
[Code]

function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord;
  external 'SetTimer@User32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord;
  external 'KillTimer@User32.dll stdcall';

var
  SubmitPageTimer: LongWord;

procedure KillSubmitPageTimer;
begin
  KillTimer(0, SubmitPageTimer);
  SubmitPageTimer := 0;
end;  

procedure SubmitPageProc(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
begin
  WizardForm.NextButton.OnClick(WizardForm.NextButton);
  KillSubmitPageTimer;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpReady then
  begin
    SubmitPageTimer := SetTimer(0, 0, 100, CreateCallback(@SubmitPageProc));
  end
    else
  begin
    if SubmitPageTimer <> 0 then
    begin
      KillSubmitPageTimer;
    end;
  end;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  Result := True;
end;

对于 CreateCallback function, you need Inno Setup 6. If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback 库。

另一种方法是将 CN_COMMAND 发送到 Next 按钮,如下所示:How to skip all the wizard pages and go directly to the installation process?