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

后端 未结 3 795
盖世英雄少女心
盖世英雄少女心 2020-12-08 05:21

This is the [Files] portion of my code so far:

[Files]
Source: \"other_installer.exe\"; DestDir: \"{app}\"
Source: \"myprogram.exe\"; DestDir: \"{app}\"
Sour         


        
相关标签:
3条回答
  • 2020-12-08 05:33

    Another good time to run prerequisite installers is in the PrepareToInstall event function. (See the example scripts provided with Inno for the basic structure, and TLama's code for the actual execution.)

    The main advantage of PrepareToInstall is that it allows you to handle errors and reboot requests from the child installer -- using AfterInstall doesn't.

    The main disadvantage of it is that you have to manually ExtractTemporaryFile anything required to run the child install, as this occurs prior to files being extracted.

    0 讨论(0)
  • 2020-12-08 05:47

    You can use AfterInstall, look for this in the Help. When file is just copied, i'll launch the function/procedure you put as "AfterInstall:".

    In this function/procedure, use Exec and launch the other installer.

    0 讨论(0)
  • 2020-12-08 05:52

    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:

    [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;
    
    0 讨论(0)
提交回复
热议问题