Inno Setup:安装其他安装程序并运行它,然后再继续安装
发布时间:2020-12-15 10:14:43 所属栏目:大数据 来源:网络整理
导读:到目前为止,这是我的代码的[Files]部分 [Files]Source: "other_installer.exe"; DestDir: "{app}"Source: "myprogram.exe"; DestDir: "{app}"Source: "data.dat"; DestDir: "{app}"Source: "otherdata.dat"; DestDir: "{app}" 我的程序依赖于另一个程序运行
到目前为止,这是我的代码的[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安装帮助中找到了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 参数。以下脚本将在处理了OtherInstaller.exe文件条目之后立即执行RunOtherInstaller功能。它试图执行刚安装的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; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |