Where Customization Begins 

  • Make a Silent Install the 7zip way.

 #5209  by Angel
 12 Apr 2010, 11:44
Time for a new Tutorial. At first there are new versions of all the stuff that's needed. Secondly are there much improvements and is there an easier way to make a 7-Zip Installer now. Third: I think most people don't know this all.

Tutorial:
1. Download the right 7zSD (always linked to latest version). Extract and place the 7zsd.sfx in a new folder.
2. Go to here and download the 7za***.zip (where *** is the version number) from the latest 7-Zip command line version. Extract and place only the 7za.exe in the same folder as 7zSD.
3. Download UPX here. Extract and place only the upx.exe in the folder where 7zSD and 7za are placed.
4. Make a subdirectory with the name Bin and copy all installation files to.
5. If you want, you can change the icon of the installer by replacing the icon in 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 rename the values of "CompanyName" and "FileDescription".
7. Create a Config.txt in the same folder as 7zSD, 7za and UPX.

Open it and set:
RunProgram="program.exe -switch"


Replace program.exe with the name of your installer (including the extension). Replace -switch with the desired switch(es) to be used. Many switches of different programs can be found here.

For a full silent 7-Zip install you add:
GUIMode="2"


It's not needed any more to add StartX.exe, msistub.exe or other supplementary tools. Then "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.

For a Register Entry (If you use a lot of Register Entries it's smart to use the parameter SetEnvironment to save time):
RunProgram="hidcon:cmd Register Entry"


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 (\").

Now, your Config.txt looks like this:
;!@Install@!UTF-8!
GUIMode="2"
RunProgram="program.exe -switch"
RunProgram="hidcon:cmd Register Entry"
;!@InstallEnd@!


You can add, edit and remove lines if you want.

* 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:

upx --ultra-brute 7zsd.sfx
cd Bin
..\7za a -mx=9 "..\Program.7z" *
cd ..
copy /b 7zsd.sfx + Config.txt + Program.7z Program_Name.exe
del Program.7z



10. Rename Program_Name to your own program name and run your Create.cmd.
11. Congratulations: you have guaranteed the littlest 7-Zip Installer as possible.

Tool:
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).

EnJoy. :D

Original by Ricktendo
Code: Select allhttp://www.wincert.net/forum/index.php?/topic/1978-tutorial-making-a-7-zip-switchless-installer/
 #25868  by Angel
 03 Mar 2013, 18:19
Smaller files and more options. For instance the able to create and copy files and folders.