【问题标题】:How to run a file before setup with Inno Setup如何在使用 Inno Setup 设置之前运行文件
【发布时间】:2011-03-30 10:27:09
【问题描述】:

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

【问题讨论】:

    标签: installation inno-setup


    【解决方案1】:

    是的。在[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;
    

    【讨论】:

    • 这就是我需要的!谢谢。
    • 如果它更改了用户计算机上的任何内容,则不应在 InitializeSetup 中执行此操作。这应该在用户按下“安装”后完成,即 PrepareToInstall() 或 CurStepChanged(ssInstall)。
    猜你喜欢
    • 2013-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多