Inno Setup: Install other installer and run it before continuing my install

Better for the way you go might be the AfterInstall parameter. The following script will execute the RunOtherInstaller function right after the OtherInstaller.exe file entry is processed. There it tries to execute the just installed OtherInstaller.exe file and if that fails, it reports an error message to the user. Please note that you cannot interrupt the installation from that function, so it’s not much safe to do what you want this way:

AppName=My Program
DefaultDirName={pf}\My Program

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

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

Leave a Comment