A switchless installer is a self-extracting file that can run any number of commands. They can be created with 7-Zip, WinRAR and other compression utilities. They are useful because users can just double click them to install or we can run them in unattended scenarios without any parameters.
I will be using the iTunes.msi file extracted from the original installer as an example, without making any changes to it. You can use another MSI file you want to convert to switchless installer. For installers that use Inno Setup, NSIS or other authoring systems, we can only compress the original installer and run it switchless. You can make your own MSI installer for this kind of applications, but I won’t be covering that, at least for now.
- 7-Zip. This is needed to compress the installation files. Download it from the developer or use my custom installer.
- 7-Zip Modified SFX Module. This modified SFX (Self-Extracting) module will give us more flexibility than the one included in 7-Zip. Get it here.
- Resource Hacker. It will allow you to add a custom icon for the installer file. Download it from the developer or use my custom installer.
The SFX Module
This is a modified 7-Zip SFX module that has greater flexibility and adds a lot more functionality than the one included in 7-Zip.
Download the 7zSD module from the link above and save it in a folder. If you want to add a custom icon for the installer file instead of using the standard 7-Zip SFX icon, open it with Resource Hacker. Navigate in the left side folder tree to Icon Group | 101 | 1049 and right click this entry. Select Replace resource, open the icon you want to use and click the Replace button.
After replacing it you should see the updated icon on the main window. Save the 7zSD file.
Using the MSI Installer
The best advantage of switchless installers is that you can make an Administrative Installation Point (AIP) from MSI setups and then compress the files using 7-Zip. Basically, an AIP is a folder structure that contains all the uncompressed installation files inside a folder hierarchy where the files will be installed by default.
To make the AIP for the iTunes installer, run this in a command prompt.
msiexec /a "C:\Users\Ruben\Desktop\iTunes.msi" TARGETDIR="C:\Users\Ruben\Desktop\iTunes" /qb
[box type=warning] The TARGETDIR folder should exist or the creation will fail. [/box]
Take into account that by default, the uncompressed MSI file inside the folder will take the same name of the file you extracted from. You can change the extracted MSI name to whatever you want.
Compressing Files With 7-Zip
Open 7-Zip and add all the files in the AIP folder to compress them. Move the itunes.7z file to the folder where you saved the 7zSD module.
Creating the Configuration File
Create a new text file using Notepad or your favorite text editor (I use my own Notepad++ custom installer) and copy this lines.
;!@Install@!UTF-8! GUIFlags="8+32" ExtractDialogText="iTunes Switchless Installer" RunProgram="iTunes.msi /qb /norestart" ;!@InstallEnd@!
Save it as config.txt in the same folder as the 7zSD module and the compressed itunes.7z file. The 7zSD module will use the config file to display information, extract the files and run the installer(s) you specified.
If you want to know more about the possible options and additional parameters, you can read the documentation.
Creating the Switchless Installer
You need to use binary copy to merge the contents of the 7zSD module, the config and the itunes.7z file to create an EXE. Make sure all the files are in the same folder.
Open a command prompt and navigate to the folder where you have your files and run the following command.
copy /b 7zsd.sfx + config.txt + itunes.7z "iTunes Switchless.exe"
When ran or double clicked, this installer will self-extract and run the commands you specified in the config file. With this quick guide you can make your own installers or modify some of the ones I publish here.
If you have any comments or questions, let me know in the comments.