Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm try to make a compressed deploy-able application.

Currently I'm taking a set of files that I've published from my IDE (Visual Studio 2008 - WPF published application) and compressing them in a 7-Zip SFX archive.

My users have asked if they can "one click install" from the 7-Zip exe. There is a parameter list when I'm creating the archive. Is there a way to set some sort of combination of parameters to invoke the installer executable that is extracted?

Unfortunately the 7-Zip documentation doesn't seem to cover this scenario. I've seen several paid applications that do something similar to this, but I'm trying to keep the tool that I'm writing free of licensed code so that we can use it internally.

share|improve this question
Could you point to some paid one's ? – abhishek77in Sep 21 '15 at 3:43
up vote 26 down vote accepted

SFX modules for installers

SFX modules for installers are included in an external package (7z_extra). You can download these modules from SFX modules for installers (7zS.sfx and 7zSD.sfx) allow you to create your own installation program. Such a module extracts the archive to the user's temp folder, and runs a specified program, and removes the temp files after the program finishes. A self-extracting archive for installers must be created as joining 3 files: SFX_Module, Installer_Config, 7z_Archive. In addition, an optional file, Installer_Config, is allowed. You can use the following command to create an installer self-extracting archive:

copy /b 7zS.sfx + config.txt + archive.7z archive.exe

An optimally small installation package size can be achieved, if the installation files are uncompressed before including them in the 7z archive.

-y switch for installer module specifies quiet mode extraction.


To specify a program to run after unpacking, use the RunProgram attribute. For example, here is a sample config.txt which runs Install.cmd after unpacking. The current working directory will be the top level of the expanded archive.7z tree, so that's where Install.cmd should reside.

Title="Your Title"

Arguments passed to the SFX executable are passed along to the Install.cmd script.

share|improve this answer
yes. I have tried it. A bit uncomfortable coz everything is command line, but you will find good documentation for it. And I get the best compression available for free. – Ganesh R. Sep 17 '09 at 17:47
After reading this answer I found this: It's basically the longer version of what is posted here. It also explains (briefly) on how to make the config.txt. – Mike G Sep 17 '09 at 19:44
@MikeG -- That link is much more thorough. It explained how to make the decompression portion completely transparent. Very nice -- Thanks! – namuol Jan 3 '13 at 11:07
Note that the "SFX modules were moved to LZMA SDK package" (available on as of version 9.35 beta. – Lukas Dec 3 '15 at 2:28

The agreed solution is correct, but it actually doesn't help in explaining what you actually need to do!. I read this and many other solutions and I could not find full and complete simple instructions on how to do this.

I you are confused like I was, please read my blog post which provides step by step instructions on how to achieve what Molly7244 has posted.

How to make a self extracting archive that runs your setup.exe with 7zip -sfx switch

It was brought to my attention that links can become dead so, here are the steps, from my blog

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

  1. Go to the folder that has your .msi and your setup.exe
  2. Select both the .msi and the setup.exe
  3. Right-Click and choose 7Zip --> "Add to Archive"
  4. Name your archive "Installer.7z" (or a name of your choice)
  5. Click Ok
  6. You should now have "Installer.7z".
  7. 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.

  1. Follow this link to go to download 7Zip
  2. You need to download the 9.20 version (as @ May-2015) as the beta does not contain the correct files.
  3. A direct download link.
  4. Extract the 7zip extra files
  5. 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++.

  1. Using windows explorer go to c:\Install
  2. right-click and choose "New Text File" and name it config.txt
  3. right-click and choose "Edit with NotePad++
  4. Click the "Encoding Menu" and choose "Encode in UTF-8"
  5. Enter something like this:

    Title="SOFTWARE v1.0.0.0"
    BeginPrompt="Do you want to install SOFTWARE v1.0.0.0?"

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:

  1. Installer.7z
  2. 7zS.sfx
  3. 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.

  1. Open a cmd window, Window + R --> cmd --> press enter
  2. In the command window type the following

    cd \
    cd Install
    copy /b 7zS.sfx + config.txt + Installer.7z MyInstaller.exe
  3. Look in c:\Install and you will now see you have a MyInstaller.exe

  4. 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.

share|improve this answer
This should be the accepted answer! – noelicus Apr 6 at 11:58
Is it possible to pass a command line arg to the ExecuteParameters item in config.txt? For example: C:\Install\MyInstaller.exe some_file.txt would execute setup.exe some_file.txt. – dthor May 10 at 20:07
Yes it is. As matthew-lundberg said in his answer, "Arguments passed to the SFX executable are passed along to the Install.cmd script" – dthor May 10 at 20:13

You should also look at NSIS. With it, you can create an installer that is compressed with the same method that 7-Zip uses (LZMA), so it should be roughly the same size, and you have full control over the installation process.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .