繁体   English   中英

如何在使用 Inno Setup 设置之前运行文件

[英]How to run a file before setup with Inno Setup

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

是的。 [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;
[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
   ResultCode: integer;
begin
   ExtractTemporaryFile('卸载.bat');
   if Exec(ExpandConstant('{tmp}\卸载.bat'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
   begin
   end
   else begin
   end;
   
end;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM