1. Download the best 7zSD aka 7z SFX Module (dynamic link to latest version). Extract and place the 7zsd.sfx in a new folder.
2. Go to this page and download the 7za***.zip (where *** is the version number). This is the 7-Zip command line version. Extract and place the 7za.exe file in the same folder as the 7zsd.sfx file.
3. Download UPX here (get the latest Win32/i386 version). Extract and place the upx.exe in the same folder as where 7zSD and 7za are placed.
4. Make a subdirectory with the name Bin and copy all the files you need for the installer to that folder.
5. If you want, you can change the icon of the installer by replacing the icon of 7zsd.sfx using ResHacker as described here.
6. You can also change the version info of the executable using ResHacker. Go to the folder Version Info in ResHacker by opening 7zsd.sfx and edit the values of "CompanyName" and "FileDescription".
7. Create a Config.txt in the same folder as 7zSD, 7za and UPX.
Open the config.txt and set:
Replace program.exe with the filename of the executable of your installer (including the extension). Replace -switch with the desired switch(es). Many switches of different programs can be found here.RunProgram="program.exe -switch"
For a full silent 7-Zip install you add:
StartX.exe, msistub.exe or other supplementary tools are not needed anymore. Also the switch "waiting" is enabled by default for 'RunProgram=', unless 'nowait:' parameter is used. Also reg-files aren't needed any more. They can be configured in the Config.txt.GUIMode="2"
For a Register Entry (If you use a lot of Register Entries it's smart to use the parameter SetEnvironment to save time):
Keep this in mind: you MUST use DOUBLE backslashes (\\) wherever you normally use backslashes (\) (e.g. in paths or dialog texts). Similarly, if the Value contains double quotes ("), you MUST precede them with a backslash (\").RunProgram="hidcon:cmd Register Entry"
Now, your Config.txt looks like this:
You can add, edit and remove lines if you want.;!@Install@!UTF-8!
RunProgram="hidcon:cmd Register Entry"
* All available configuration parameters and other helpful information can be found here (site is just translated from Russian to English).
8. Save Config.txt with UTF-8 encoding by selecting "UTF-8" from the dropdown menu in the "Save As..." dialog in Notepad.
9. Make a Create.cmd in the same folder as the Config.txt and past the following:
10. Rename Program_Name to your own program name and run your Create.cmd.upx --ultra-brute 7zsd.sfx
..\7za a "..\Program.7z" -r *.* -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on
copy /b 7zsd.sfx + Config.txt + Program.7z Program_Name.exe
11. Congratulations: you have guaranteed the littlest 7-Zip Installer as possible.
Utility that can extract 7z archive and config file (Config.txt) as well as SFX module (7zsd.sfx) from 7z SFX archive. It has the name 7z SFX Archive Splitter (from the 7z SFX creator) and you can download it here (always linked to latest version).