Unpack SFX file using Inno Setup

521 views Asked by At

I'm trying to run Inno Setup to automatically extract my SFX file without having to run extract manually. Is there any way? I leave my script below.

Is there also a way to make Inno Setup extract the SFX in the Myprogramfolder created by the installer?

I have compressed the SFX file using Winrar.

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

#define MyAppName "Program2019"
#define MyAppVersion "1.0"
#define MyAppPublisher "Myappname."
#define MyAppURL "/"

[Setup]
WizardImageFile=C:\Users\Administrator\Desktop\Cover.bmp
; NOTE: The value of AppId uniquely identifies this application.
AppID={{31D336CF-0483-4A76-00000000000000000}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
DefaultDirName={pf}\Myprogram2019
DefaultGroupName={#MyAppName}
LicenseFile=C:\Users\Administrator\Desktop\Program2019\readme.txt
OutputDir=C:\Users\Administrator\Desktop\Program2019\Myprografolder
OutputBaseFilename=setup
SetupIconFile=C:\Users\Administrator\Desktop\Program2019\Myprogram\icon.ico
Compression=none
SolidCompression=true
InternalCompressLevel=Fast

[Languages]
Name: "english"; MessagesFile: "compiler:Languages\English.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"

[Files]
Source: "C:\Program Files (x86)\Myprogramfolder\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\Administrator\Desktop\Program2019\Unpack\Evilpack.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
Source: "C:\Users\Administrator\Desktop\Program2019\languages\spanish\*"; DestDir: "{app}\game"; Languages: spanish; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Run]
Filename: "{tmp}\Evilpack.exe"; Parameters: "{tmp}\ZipFile.ZIP -d C:\TargetDir"

[Icons]
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Myprogram2019"; Filename: "{app}\mypro.exe";  IconFilename: {app}\icon.ico; \
  AfterInstall: SetElevationBit('{commondesktop}\Myprogram.lnk')

[Code]
{ RedesignWizardFormBegin } // Don't remove this line!
// Don't modify this section. It is generated automatically.
procedure RedesignWizardForm;
begin
{ ReservationBegin }
  // This part is for you. Add your specialized code here.

{ ReservationEnd }
end;

[Messages]
BeveledLabel=Myapp

enter image description here

1

There are 1 answers

1
MrBi On

Is very easy unpack in silent way SFX, setup to silent from the menu option ADVANCED, then SFX options in winrar. That is all!!

enter image description here

enter image description here

enter image description here

enter image description here

Finally

[Files]
Source: "C:\pathtofile\yoursfx.exe"; DestDir: "C:\Program Files\";Flags: ignoreversion
[Run]
Filename: "C:\Program Files\yoursfx.exe";  StatusMsg: "Your MSG"; Flags:  runascurrentuser


 [Code]
 procedure CurStepChanged(CurStep: TSetupStep);
 begin
 if CurStep = ssDone  then
  begin;

  DeleteFile(ExpandConstant('C:\Program Files\yoursfx.exe'));

   begin
  // user clicked Yes
  end;
  end;
  end;