5

I want a software installer to execute another exe/installer once the one installer finish installing. No matter which installer used (NSIS, Inno Setup etc.) to make it, I just want to do this.

Is it even possible?

Jared Mikz
  • 71
  • 2
  • 3

3 Answers3

4

You can use just [RUN] section with parameters and standard or custom Checks. Remember about setting priopriate Flags - waituntilterminated makes the installer script to wait until one launched has finished it's actions and then launcher next one.

Example:

[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, '&', '&&')}}"
RobeN
  • 5,346
  • 1
  • 33
  • 50
  • Thanks for your answer. This script seems to be Inno script. Can you please tell me how can I add EXEs and drop them in temp dir? I have never worked with Inno. – Jared Mikz Jan 09 '13 at 10:39
  • I have added `[Files]` section. You just point files to be copied to `{tmp}`. After the Installation Process is Finished, all files placed in installer's `{tmp}` will be deleted. In C:\MyInstallers I have all additional installers I want to call in `[Run]` section (with DirectX in Subfolder). – RobeN Jan 09 '13 at 12:02
2

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
Anders
  • 97,548
  • 12
  • 110
  • 164
0

In innosetup you can also another installation with the ShellExec-Function. With that you can define if it should in front and if the main installation should wait until this subinstallation is finished.

Here a short example, where I start the installation of the sqltools in the Code-Section

  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;
Al Phaba
  • 6,545
  • 12
  • 51
  • 83