So currently my users download a zipfile, unzip it and then run setup.exe - I would like them to do this with one click. Using http://www.wikihow.com/Use-7Zip-to-Create-Self-Extracting-excutables i can make a self-extracting exe, but it doesn't actually run the installer.
From this question
Why does 7zip Ignore my InstallPath when making a SFX installer?
it seems I also need an .sfx file so I copied from the other question and created one with the following contents
;!@Install@!UTF-8! InstallPath="C:\\test" GUIMode="2" RunProgram="setup.exe" ;!@InstallEnd@!
and called setup.sfx and add this to archive together with the other files
setup.ini setup.exe setup.ico install.jar JVM32 (folder)
but it made no difference, what else do I need to do.
Supplementary question, I also have WinRar, does it effect the end user experience whether I use 7Zip or Winrar ?
Creating self-extracting archive in Windows Select the “iexpress” program. On the first screen, select “Create new Self-Extraction Directive file” and click Next. On the next screen, select “Extract files only”. This will create an self-extracting archive, rather than an installer.
A PKSFX file is a self-extracting ZIP file with a .exe file name extension. You can extract a self-extracting PKSFX file simply by running it—for example, by double-clicking it in Windows Explorer. You do not need Smartcrypt or any other program to run a self-extracting PKSFX file.
If you want to create a self-extracting installer, you need to prepare a separate start-up script which will do the installation upon file extraction. Here I assume that the program directory to package is located at ./program.
While there are lots of applications for you to create self-extracting archive, here are the native tools that come in your OS. 1. While you can create self-extracting archive in Windows and Linux, the created archive is not cross-platform compatible. You can’t create a self-extracting archive in Windows and expect it to work in Linux.
Select the “iexpress” program. On the first screen, select “Create new Self-Extraction Directive file” and click Next. On the next screen, select “Extract files only”. This will create an self-extracting archive, rather than an installer.
In Windows (from XP up to Windows 8), open the “Run” menu and type “iexpress“. Select the “iexpress” program. On the first screen, select “Create new Self-Extraction Directive file” and click Next.
Okay I have got it working, hope this information is useful.
First of all I now realize that not only do self-extracting zip start extracting with doubleclick, but they require no extraction application to be installed on the users computer because the extractor code is in the archive itself. This means that you will get a different user experience depending on what you application you use to create the sfx
I went with WinRar as follows, this does not require you to create an sfx file, everything can be created via the gui:
The resultant exe unzips to a temporary folder and then starts the installer
I have created step by step instructions on how to do this as I also was very confused about how to get this working.
How to make a self extracting archive that runs your setup.exe with 7zip -sfx switch
Here are the steps.
To make this easy create a folder c:\Install. This is where we will copy all the required files.
You need to download 7zSD.sfx
7zSD.sfx
in the bin
folder.I would recommend using NotePad++ to edit this text file as you will need to encode in UTF-8, the following instructions are using notepad++.
Enter something like this:
;!@Install@!UTF-8! Title="SOFTWARE v1.0.0.0" BeginPrompt="Do you want to install SOFTWARE v1.0.0.0?" RunProgram="setup.exe" ;!@InstallEnd@!
Edit this replacing [SOFTWARE v1.0.0.0] with your product name. Notes on the parameters and options for the setup file are here.
You should now have a folder "c:\Install" with the following 3 files:
These instructions I found on the web but nowhere did it explain any of the 4 steps above.
In the command window type the following
cd \ cd Install copy /b 7zSD.sfx + config.txt + Installer.7z MyInstaller.exe
Look in c:\Install and you will now see you have a MyInstaller.exe
Double click on MyInstaller.exe and it will prompt with your message. Click OK and the setup.exe will run.
Now that you have this working in your c:\Install directory I would create an "Install.bat" file and put the copy script in it.
copy /b 7zSD.sfx + config.txt + Installer.7z MyInstaller.exe
Now you can just edit and run the Install.bat every time you need to rebuild a new version of you deployment package.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With