如何在使用Inno Setup进行安装之前运行文件

Ste*_*lke 19 installation installer inno-setup

在设置开始之前,是否可以使用Inno Setup运行文件? 文档

Jan*_*erk 24

是的.在该[code]部分中运行该InitializeSetup()函数中的文件.此示例在安装程序运行之前启动记事本.

function InitializeSetup(): boolean;
var
  ResultCode: integer;
begin

  // Launch Notepad and wait for it to terminate
  if Exec(ExpandConstant('{win}\notepad.exe'), '', '', SW_SHOW,
     ewWaitUntilTerminated, ResultCode) then
  begin
    // handle success if necessary; ResultCode contains the exit code
  end
  else begin
    // handle failure if necessary; ResultCode contains the error code
  end;

  // Proceed Setup
  Result := True;

end;
Run Code Online (Sandbox Code Playgroud)

  • 如果在用户计算机上更改了任何内容,则不应在InitializeSetup中执行此操作.这应该在用户按下"Install"后完成,即PrepareToInstall()或CurStepChanged(ssInstall). (18认同)