How to get Inno Setup to unzip a file it installed (all as part of the one installation process)

前端 未结 4 2073
余生分开走
余生分开走 2020-11-29 06:37

To save bandwidth/space as well as prevent accidental meddling, the installation files for a database product (call it Ajax), have been zipped up (call that file \"AJAX_Inst

4条回答
  •  暖寄归人
    2020-11-29 07:27

    You can just create silent self-extracting archive (SFX) archive, example described here how to create SFX archive for stuff you need, and write Pascal code to just run it like this (script for Inno Setup 6.0.2):

    [Tasks]
    Name: "intallSenselockDriver"; Description: "Install Senselock driver."; GroupDescription: "Install the necessary software:";
    
    [Code]
    function ExecTmpFile(FileName: String): Boolean;
    var
      ResultCode: Integer;
    begin
      if not Exec(ExpandConstant('{tmp}\' + FileName), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode)
      then
        begin
          MsgBox('Other installer failed to run!' + #13#10 + SysErrorMessage(ResultCode), mbError, MB_OK);
          Result := False;
        end
      else
        Result := True;
    end;
    
    procedure RunOtherInstallerSFX(ArchiveName: String; ExePath: String);
    begin
      ExtractTemporaryFile(ArchiveName);
      ExecTmpFile(ArchiveName);
      ExecTmpFile(ExePath);
    end;
    
    function PrepareToInstall(var NeedsRestart: Boolean): String;
    begin
      if WizardIsTaskSelected('intallSenselockDriver') then
        RunOtherInstallerSFX('1_senselock_windows_3.1.0.0.exe', '1_senselock_windows_3.1.0.0\InstWiz3.exe');
    
      Result := '';
    end;
    

    It worked perfectly for me.

提交回复
热议问题