Jui*_*icy 24 installer inno-setup
到目前为止,这是我的代码的[Files]部分:
[Files]
Source: "other_installer.exe"; DestDir: "{app}"
Source: "myprogram.exe"; DestDir: "{app}"
Source: "data.dat"; DestDir: "{app}"
Source: "otherdata.dat"; DestDir: "{app}"
Run Code Online (Sandbox Code Playgroud)
我的程序依赖于另一个程序来运行.我在我的安装程序中包含了该程序的安装程序("other_installer.exe").我想要做的是在复制后立即启动此安装程序,然后再继续使用"myprogram.exe"和其他内容.
我用Google搜索并在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}"
Run Code Online (Sandbox Code Playgroud)
TLa*_*ama 32
你的方式更好可能是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;
Run Code Online (Sandbox Code Playgroud)
Mir*_*ral 10
运行必备安装程序的另一个好时机是PrepareToInstall事件功能.(有关基本结构,请参阅Inno提供的示例脚本,以及实际执行的TLama代码.)
它的主要优点PrepareToInstall是它允许您处理错误并重新启动来自子安装程序的请求 - AfterInstall请勿使用.
它的主要缺点是您必须手动ExtractTemporaryFile运行子安装所需的任何操作,因为这是在提取文件之前发生的.