This is an old revision of the document!


Create Self-extracting archive
Setup your installation folder

Create a folder C:\Install. This is where we will copy all the required files.

Compress Files Using 7z Format
  1. Compress files using 7z format, including the setup.exe file you want to autorun.
  2. Copy this new .7z file to C:\Install directory.
Get the 7z-Extra SFX extension module

You need to download the 7z-Extra.

  1. Download 7-Zip Extra package (18.05 version, as @ June 2018, or above) from 7-Zip download.
  2. Extract the 7z-Extra files.
  3. Copy the file 7zS.sfx to C:\Install.
Setup your config.txt

Created file C:\Install\config.txt with UTF-8 encoding.

;!@Install@!UTF-8!
Title="MYAPP v1.0.0.0"
BeginPrompt="Do you want to install MYAPP v1.0.0.0?"
RunProgram="setup.exe"
;!@InstallEnd@!

Replace [MYAPP v1.0.0.0] with your product name.

See SFX parameters and options for the setup file: -sfx (Create SFX archive) switch and SFX parameters and examples.

CheckPoint

You should now have a folder C:\Install with the following 3 files:

  1. Installer.7z
  2. 7zS.sfx
  3. config.txt
Create the archive

Run in command line to create the target file MyInstaller.exe:

C:\> CD C:\Install
C:\Install\> COPY /B 7zS.sfx + config.txt + Installer.7z MyInstaller.exe

In C:\Install, there should be a file MyInstaller.exe now. You are done.

References