首页 > 解决方案 > 使用 Inno Setup 解压 SFX 文件

问题描述

我正在尝试运行 Inno Setup 来自动提取我的 SFX 文件,而无需手动运行提取。有什么办法吗?我把我的脚本留在下面。

还有一种方法可以让 Inno Setup 提取安装程序创建的 Myprogramfolder 中的 SFX 吗?

我已经使用 Winrar 压缩了 SFX 文件。

; 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

在此处输入图像描述

标签: inno-setupsfx

解决方案


很容易以静音方式解压缩 SFX,从菜单选项 ADVANCED 设置为静音,然后在 winrar 中设置 SFX 选项。就这些!!

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

最后

[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;
     

推荐阅读