7zip 自解压安装程序

时间:2023-01-11 05:37:50

包含自解压安装器的包
https://jaist.dl.sourceforge.net/project/sevenzip/7-Zip/9.20/7z920_extra.7z
详细说明见7-zip帮助文档的Index:-sfx (Create SFX archive) switch

模块
7z.sfx SFX module (GUI version)
7zCon.sfx SFX module (Console version)
7zS.sfx SFX module for installers (GUI version)
7zSD.sfx SFX module for installers (GUI version) (uses msvcrt.dll)
7zS2.sfx small SFX module for installers (GUI version) (uses msvcrt.dll)
7zS2con.sfx small SFX module for installers (Console version) (uses msvcrt.dll)

制作安装

copy /b 7zSD.sfx + config.txt + archive.7z archive.exe

配置文件config.txt要求UTF-8编码
例子
;!@Install@!UTF-8!
Title="7-Zip 4.00"
BeginPrompt="Do you want to install the 7-Zip 4.00?"
RunProgram="setup.exe"
;!@InstallEnd@!

;!@Install@!UTF-8!
Title="7-Zip 4.00"
BeginPrompt="Do you want to install the 7-Zip 4.00?"
ExecuteFile="7zip.msi"
;!@InstallEnd@!

;!@Install@!UTF-8!
Title="7-Zip 4.01 Update"
BeginPrompt="Do you want to install the 7-Zip 4.01 Update?"
ExecuteFile="msiexec.exe"
ExecuteParameters="/i 7zip.msi REINSTALL=ALL REINSTALLMODE=vomus"
;!@InstallEnd@!

追加文件到sfx包
7z a -sfx a.exe *.txt
7z a -sfx a.exe *