Skip to main content

How to create self-extracting 7z archives

Note: This is not an easy task and requires intermediate or advanced knowledge in batch files, parameters, encoding, escape sequences and such computing terms. If you are a beginner, you should create a self-extracting Zip archive, which can be easily done using software such as WinZip.

To successfully create an SFX (self-extracting) archive, you need three parts and a batch program to combine them together. The three parts are:

  • SFX module, the executable code of the SFX archive
  • Configuration file, provides options that control the behavior of the SFX archive.
  • 7z archive, contains the files and folders you want to extract.

Download the required SFX module from Download Links. You would most likely use an LZMA module, which is the default compression method of 7z. The first or second download link should be sufficient, but you must remember to use the module that corresponds to the compression method of your 7z archive. If you are not sure, just use the 7ZSD_All module which is compatible with all compression methods.

Extract the modules into a folder. From now on, we will be working in this folder. Create a configuration file "config.txt" and edit it. The documentation (third link in the download page) provides full-fledged help on what you can include in this configuration file and how to use it. But here's a quick overview. The file should begin and end like this:



Any configuration parameter you wish to include should be between these two lines. There are several parameters that can be included here and I don't wish to go through all of them. You can check the documentation which provides in full detail what they are and how to use them. However the most important parameters are:

InstallPath - an absolute or relative path to which the contents must be extracted. If the path is relative, it will be created in the folder where the SFX archive is.

RunProgram - an application or file in the archive which should be run/opened after the extraction is complete. Do not include the InstallPath value. "nowait:" can be used before the file name to free up memory taken up by the SFX archive after it has extracted.

GUIFlags - controls the user-interaction behavior of the SFX archive. There are several values you can include here as explained in the documentation. For example, if you wish to display the extraction percentage on right (1), display an icon in the extraction window (32), confirm with the user if they click Cancel (256) and replace the question mark with an icon (2048), you should enter the value as "1+32+256+2048" or add them up to "2337"

If you have placed the above three parameters, your configuration file would look similar to this example:


Explore the documentation as there are many more parameters that can be used to add your own messages to the SFX archive, such as licence agreements, instructions, etc.

Once you have prepared the configuration file, place the 7z archive in our working folder. Create an MS-DOS batch file (example, runme.bat) and edit it. The batch file only needs to have one line. Here is an example:

copy /b 7ZSD_LZMA.sfx + config.txt + Archive.7z SFX.exe

7ZSD_LZMA.sfx - This is the SFX module. You may change the name if you are using a different module such as 7ZSD_Deflate or 7ZSD_All.

config.txt - This is the configuration file. You may change the name if your file has a different name.

Archive.7z - This is the 7z archive. Change the name to match your archive.

SFX.exe - This is the file name of the output SFX archive. You may choose any name you like, but keep the ".exe" part.

Please note that the order of the three input files should be maintained. Save and run this batch file and you should see a new EXE file (in example above, SFX.exe), which is the self-extracting archive. Test the SFX archive before deploying.


  1. Thank you, this was extremely helpful. Finally after reading this guide, I managed to crate a successful sfx =)

  2. this was exactly wat i was looking for.
    heavy 7zip archive with progrees bar, cancel button.
    and so small...!!!

    you rock man!!!, i needed it really!!

    you seem to be a really interesting man...

    do tell me more abuot u...

  3. Thank you so much, these few lines are all thats missing from the info provided at.

    Thanks again you made my day!!


Post a Comment

Comments are moderated, and are usually posted within 24 hours if approved. You must have a minimum of OpenID to post comments.

Popular posts from this blog

Disable auto save in JetBrains IDE software (IntelliJ IDEA, PyCharm, PhpStorm)

JetBrains provides the following IDE software:
IntelliJ IDEAPhpStormPyCharmRubyMineWebStormAppCodeCLion Google also provides Android Studio which is powered by the IntelliJ platform.

If you come from a different IDE such as Eclipse, you will be unpleasantly surprised to find that JetBrains-branded IDEs automatically save everything the moment you look away. The proponents argue that as you work on your project, you should not have to worry about saving files. But to others, this auto-save behavior which is enabled by default is a curse that catches them by surprise, and a shocking departure from the workflow they are very much used to.

You can change the behavior by altering some settings.

Stop having to click Unblock on every downloaded file

CAUTION: The blocking of downloaded files in Windows is a security and safety feature to help prevent your computer from being infected by viruses and other malware. Only disable this feature if you know what you're doing.

I had been plagued by this annoyance since the days of Windows Vista. Any downloaded file, no matter what browser I use, gets tagged as "blocked" by Windows. You can open downloaded documents even though they are blocked, but when you run a downloaded application (such as a setup file) you're presented with a "Security Warning" before you're allowed to run it. It's worse if you extract a downloaded ZIP file with the Windows' built-in ZIP management. Every extracted file is blocked by default.

Being a geek who finds unnecessary "security" prompts annoying, the first thing I do in Windows is to disable the User Account Control (UAC). But I couldn't quite figure out how to disable blocking of downloaded files until …

Setting up a local Oracle XE database and importing DMP file

The experience of setting up a local Oracle Express Edition database is not a straight-forward as it should be. The following is supposed to outline what could go wrong and how to go about it the right way. It also includes importing a DMP file (a dump) from another system.
First of all, download the installer from Oracle website. You will need to sign-in to download - the account creation is free. Be sure to choose the correct bit as per your computer (x64 or x86).Extract the download and install XE by running DISK1\setup.exe (and feel nostalgic of the floppy disk era). During installation, you will need to choose a new password. There will also be some details displayed after you enter the new password, such as folders and ports.Be sure to save both password and details in a text file for future reference.I saved it as C:\oraclexe\details.txt.Save password only if it's generic and you are likely to forget. The installation will take a while, but usually, no restart is necessary.O…