Create Self-extracting archive

Source: http://ntsblog.homedev.com.au/index.php/2015/05/14/self-extracting-archive-runs-setup-exe-7zip-sfx-switch/

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. Extract the 7z-Extra files.
  2. Copy the file 7zS.sfx to C:\Install.
Setup 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=".\\myappdir\\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.

Create the archive

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

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