我想要一个软件安装程序在一个安装程序完成安装后执行另一个exe/installer。无论使用哪个安装程序(NSIS,Inno Setup等),我只是想做到这一点。在一个安装程序中执行多个安装程序/ exe文件?
这有可能吗?
我想要一个软件安装程序在一个安装程序完成安装后执行另一个exe/installer。无论使用哪个安装程序(NSIS,Inno Setup等),我只是想做到这一点。在一个安装程序中执行多个安装程序/ exe文件?
这有可能吗?
您只能使用[RUN]
部分的parameters
和标准或自定义Checks
。 记住关于设置prograriate Flags
- waituntilterminated
使安装程序脚本等待,直到一个启动完成它的行动,然后启动下一个。
例子:
[Files]
Source: "C:\MyInstallers\*"; DestDir: "{tmp}";
Flags: createallsubdirs recursesubdirs deleteafterinstall ignoreversion uninsremovereadonly
[Run]
Filename: "{tmp}\dotnetfx35.exe"; Parameters: "/q";
Flags: waituntilterminated skipifdoesntexist;
StatusMsg: "Instalacja bibliotek Microsoft .NET Framework 3.5 SP1...";
OnlyBelowVersion: 0,6.2.8400; Check: NET35
Filename: "{tmp}\vcredist_x86.exe"; Parameters: "/Q";
Flags: waituntilterminated skipifdoesntexist;
StatusMsg: "Instalacja bibliotek Microsoft Visual C++ 2008 (x86)...";
Check: not Is64BitInstallMode
Filename: "{tmp}\vcredist_x64.exe"; Parameters: "/Q";
Flags: waituntilterminated skipifdoesntexist;
StatusMsg: "Instalacja bibliotek Microsoft Visual C++ 2008 (x64)...";
Check: Is64BitInstallMode
Filename: "{tmp}\directx\DXSETUP.exe"; Parameters: "/silent";
Flags: waituntilterminated skipifdoesntexist;
StatusMsg: "Instalacja bibliotek Microsoft DirectX..."
Filename: "{app}\{#MyAppExeName}"; WorkingDir: "{app}\";
Flags: nowait postinstall runascurrentuser skipifsilent;
Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"
NSIS:
Section
InitPluginsDir ; $pluginsdir is a folder in %temp%, it is deleted for you when the installer ends
SetOutPath $PluginsDir
File "child1.exe"
ExecWait '"$PluginsDir\child1.exe" /foo "/bar" /baz'
Delete "$PluginsDir\child1.exe" ; Optional, might be a good idea if the file is large...
File "child2.exe"
ExecWait '"$PluginsDir\child2.exe"'
SetOutPath $Temp ; Don't lock $PluginsDir
SectionEnd
非常感谢您的帮助! –
在innosetup你也可以安装其他与ShellExec-功能。有了它,你可以定义它是否应该在前面,并且主要安装是否应该等到这个子安装完成。
这里很短的例子,在那里我开始sqltools安装在代码段
if ShellExec('',INSTALL_FOLDER + '\FPS\contributed\sqlncli_x64.msi', '' ,'',SW_HIDE,ewWaitUntilTerminated,ResultCode) then
begin
Log('executed sql native client with result code ' + IntToStr(ResultCode) + ' this means ' + SysErrorMessage(ResultCode));
end
else
begin
showError(CustomMessage('SQLNATIVE_CLIENT_ABORTED') + SysErrorMessage(ResultCode));
end;
谢谢您的回答。这个脚本似乎是Inno脚本。 你能告诉我如何添加EXE并将它们放入临时目录吗?我从未与Inno合作过。 –
我已经添加了'[Files]'部分。你只需要将文件复制到'{tmp}'。安装过程完成后,放置在安装程序“{tmp}”中的所有文件都将被删除。在C:\ MyInstallers中,我想要在'[Run]'部分中调用所有其他安装程序(在子文件夹中使用DirectX)。 – RobeN