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

发布于 2024-09-14 04:58:58 字数 152 浏览 2 评论 0原文

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

Is it possible to run a file with Inno Setup, before the setup begins?
Documentation

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情感失落者 2024-09-21 04:58:58

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

Yes it is. In the [code] section run the file in the InitializeSetup() function. This example launches notepad before the setup runs.

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;
各自安好 2024-09-21 04:58:58
[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;

详细图片

[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;

detail image

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文