Dec 21, 2020 Replies: 3 Part 1 I have been on the lookout for a simple way to create an installer for my server apps - Ive looked at Inno Setup etc before but I wanted something simple. My apps are currently bundled as zip files which are then given to customers. Although this works its a not as desirable as a proper installer as the user may not unzip it correctly. As I was already distributing as a zip file I got to thinking about self-extracting archive. It turns out that 7-zip can already support this through the UI My release packing is scripted so I wanted to script the self-extracting archive as well. Here is the documentation for the command line to create a self-extracting archive (SFX) -sfx (Create SFX archive) switch To script a SFX we need to create config file like this; Code: Copy ;!@Install@!UTF-8! Title="7-Zip 4.00" BeginPrompt="Do you want to install the 7-Zip 4.00?" RunProgram="setup.exe" ;!@InstallEnd@! And then use command line to merge the SFX and your zip file like this (I place the sfx and confil files in the same directory as my zipped project); Code: Copy copy /b 7zSD.sfx + config.txt + myB4Jproject.7z MyInstaller.exe This will create an executable called MyInstaller.exe that the user can run and be prompted for a location to unzip to. Last edited: Dec 21, 2020 Click to expand...
Part 1 I have been on the lookout for a simple way to create an installer for my server apps - Ive looked at Inno Setup etc before but I wanted something simple. My apps are currently bundled as zip files which are then given to customers. Although this works its a not as desirable as a proper installer as the user may not unzip it correctly. As I was already distributing as a zip file I got to thinking about self-extracting archive. It turns out that 7-zip can already support this through the UI My release packing is scripted so I wanted to script the self-extracting archive as well. Here is the documentation for the command line to create a self-extracting archive (SFX) -sfx (Create SFX archive) switch To script a SFX we need to create config file like this; Code: Copy ;!@Install@!UTF-8! Title="7-Zip 4.00" BeginPrompt="Do you want to install the 7-Zip 4.00?" RunProgram="setup.exe" ;!@InstallEnd@! And then use command line to merge the SFX and your zip file like this (I place the sfx and confil files in the same directory as my zipped project); Code: Copy copy /b 7zSD.sfx + config.txt + myB4Jproject.7z MyInstaller.exe This will create an executable called MyInstaller.exe that the user can run and be prompted for a location to unzip to.
tchart Well-Known Member Licensed User Longtime User Dec 21, 2020 #2 Part 2 In addition to the above you can also specify whether the SFX should execute a program after the extraction. This is useful for example if you wish to register the app as a windows service.
Part 2 In addition to the above you can also specify whether the SFX should execute a program after the extraction. This is useful for example if you wish to register the app as a windows service.
tchart Well-Known Member Licensed User Longtime User Dec 21, 2020 #3 Part 3 (for more advanced users) While the default SFX is useful you will probably notice a few things. 1. You cant specify the default extraction directory 2. If your additional executable requires elevated privileges (ie admin) the user wont know until its too late This lead me to this project; https://sourceforge.net/projects/s-zipsfxbuilder/ 7z SFX Builder is a GUI application that allows you to have greater control over the SFX process. Options include the requirement for admin as well as custom dialogs and a default extract path. NOTE this project is open source but it is not part of the official 7-zip package, as a result some people seem apprehensive to use it. Last edited: Dec 21, 2020
Part 3 (for more advanced users) While the default SFX is useful you will probably notice a few things. 1. You cant specify the default extraction directory 2. If your additional executable requires elevated privileges (ie admin) the user wont know until its too late This lead me to this project; https://sourceforge.net/projects/s-zipsfxbuilder/ 7z SFX Builder is a GUI application that allows you to have greater control over the SFX process. Options include the requirement for admin as well as custom dialogs and a default extract path. NOTE this project is open source but it is not part of the official 7-zip package, as a result some people seem apprehensive to use it.
tchart Well-Known Member Licensed User Longtime User Dec 21, 2020 #4 Part 4 (Bonus round) The resulting executable has a 7-zip icon and has the default file properties. You can use a program like Resource Hacker (http://www.angusj.com/resourcehacker/) to edit either the resulting executable or even the original 7zSD.sfx file (the .sfx file is an executable so it can be edited via Resource Hacker too).
Part 4 (Bonus round) The resulting executable has a 7-zip icon and has the default file properties. You can use a program like Resource Hacker (http://www.angusj.com/resourcehacker/) to edit either the resulting executable or even the original 7zSD.sfx file (the .sfx file is an executable so it can be edited via Resource Hacker too).