= 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 ==
# Compress files using 7z format, including the ''setup.exe'' file you want to autorun.
# Copy this new .7z file to ''C:\Install'' directory.
== Get the 7z-Extra SFX extension module ==
You need to download the 7z-Extra.
# [[http://downloads.sourceforge.net/sevenzip/7z920_extra.7z|Download 7-Zip Extra package]] (9.20 version) from [[http://www.7-zip.org/download.html|7-Zip download]].
# Extract the 7z-Extra files.
# 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: [[http://sevenzip.osdn.jp/chm/cmdline/switches/sfx.htm|-sfx (Create SFX archive) switch]] and [[http://tools.oszone.ru/7zsfx/en/|SFX parameters and examples]].
== Create the archive ==
You should now have a folder ''C:\Install'' with the following 3 files:
* ''Installer.7z''
* ''7zS.sfx''
* ''config.txt''
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 ==
* [[https://sourceforge.net/projects/s-zipsfxbuilder/?source=typ_redirect|7-zip SFX Builder]]
* [[http://tools.oszone.ru/7zsfx/en/|SFX Configuration File]]
* [[https://sevenzip.osdn.jp/chm/cmdline/switches/sfx.htm|-sfx (Create SFX archive) switch]]