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
Step 1 - Setup your installation folder
To make this easy create a folder c:\Install. This is where we will copy all the required files.
Step 2 - 7Zip your installers
- Go to the folder that has your .msi and your setup.exe
- Select both the .msi and the setup.exe
- Right-Click and choose 7Zip --> "Add to Archive"
- Name your archive "Installer.7z" (or a name of your choice)
- Click Ok
- You should now have "Installer.7z".
- Copy this .7z file to your c:\Install directory
Step 3 - Get the 7z-Extra sfx extension module
You need to download the 7z-Extra.
- Follow this link to go to download 7Zip
- You need to download the 9.20 version (as @ May-2015) as the beta does not contain the correct files.
- A direct download link.
- Extract the 7zip extra files
- Copy the file "7zS.sfx" to c:\Install
Step 4 - Setup your config.txt
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++.
- Using windows explorer go to c:\Install
- right-click and choose "New Text File" and name it config.txt
- right-click and choose "Edit with NotePad++
- Click the "Encoding Menu" and choose "Encode in UTF-8"
- 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
CheckPoint
You should now have a folder "c:\Install" with the following 3 files:
- Installer.7z
- 7zS.sfx
- config.txt
Step 5 - Create the archive
These instructions I found on the web but nowhere did it explain any of the 4 steps above.
- Open a cmd window, Window + R --> cmd --> press enter
- In the command window type the following
cd \
cd Install
copy /b 7zS.sfx + config.txt + Installer.7z MyInstaller.exe
- Look in c:\Install and you will now see you have a MyInstaller.exe
You are finished
Run the installer
Double click on MyInstaller.exe and it will prompt with your message. Click OK and the setup.exe will run.
P.S. Note on Automation
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 7zS.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.
The problem is that the default is opening with 7zG (gui) while it should open with 7zFM (file manager).
You can change this using a program like DefaultProgramsEditor
Good luck.
Best Answer
From what I can gather from your comments, it sounds like you are asking something else. It sounds like you are asking
If so, then the answers are simple (and related):
The Parameters field is for specifying any options you need that are not available via dedicated dialog controls.
The
-o
argument is ignored in the Parameters field because there is already a dedicated dialog control for the destination. The controls override corresponding options in the Parameters field.Think about it this way, if you want to specify arguments in the Parameters field that already have dialog controls, then why use the GUI at all, why not just use the command-line in the first place? The dialog controls provide most options that are used and also reduce the possibility of error by specifying valid options. For example, the word-size options are already listed in the drop-down, so you cannot choose an invalid size like you can when specifying it in the Parameters field or command-line.
Some examples of usage of the Parameters field include:
One such argument is exclusion (
-x
switch). If you want to specify filenames to be excluded, there is no option to do so in the dialog, and so you would have to enter them in the Parameters field.You would also use it to specify the
-y
switch to automatically say yes to everything instead of prompting you.You can even use it to override some of the options that the dialog automatically sets such as subdirectory recursion. When you use the dialog, it automatically sets recursion. If you don’t want that, you would need to specify
-r-
in the Parameters field.For a full list, you can look at the list of command-line arguments (
7z /?
) and compare it to the controls in the dialog.