gpt4 book ai didi

installation - Inno安装程序:在继续安装之前,请安装其他安装程序并运行它

转载 作者:行者123 更新时间:2023-12-03 10:54:04 24 4
gpt4 key购买 nike

到目前为止,这是我代码的[Files]部分:

[Files]
Source: "other_installer.exe"; DestDir: "{app}"
Source: "myprogram.exe"; DestDir: "{app}"
Source: "data.dat"; DestDir: "{app}"
Source: "otherdata.dat"; DestDir: "{app}"

我的程序依赖于另一个程序来运行。我已经在安装程序中包含了该程序的安装程序(“other_installer.exe”)。我想做的就是在复制完该安装程序后立即启动它,然后继续“myprogram.exe”和其他操作。

我已经在Inno Setup帮助中搜索并找到了BeforeInstall的文档,但是他们没有运行其他应用程序的示例。我相信应该是这样的:
[Files]
Source: "other_installer.exe"; DestDir: "{app}"
Source: "myprogram.exe"; DestDir: "{app}"; BeforeInstall: // RUN OTHER_INSTALLER.EXE //
Source: "data.dat"; DestDir: "{app}"
Source: "otherdata.dat"; DestDir: "{app}"

最佳答案

更好的方式可能是 AfterInstall 参数。下面的脚本将在处理RunOtherInstaller文件条目后立即执行OtherInstaller.exe函数。在那里,它尝试执行刚刚安装的OtherInstaller.exe文件,如果失败,它将向用户报告错误消息。请注意,您不能从该功能中断安装,因此以这种方式进行操作并不安全:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Files]
Source: "OtherInstaller.exe"; DestDir: "{app}"; AfterInstall: RunOtherInstaller
Source: "OtherFile.dll"; DestDir: "{app}"

[Code]
procedure RunOtherInstaller;
var
ResultCode: Integer;
begin
if not Exec(ExpandConstant('{app}\OtherInstaller.exe'), '', '', SW_SHOWNORMAL,
ewWaitUntilTerminated, ResultCode)
then
MsgBox('Other installer failed to run!' + #13#10 +
SysErrorMessage(ResultCode), mbError, MB_OK);
end;

关于installation - Inno安装程序:在继续安装之前,请安装其他安装程序并运行它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19589309/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com