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 Solta.ru 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:

;!@Install@!UTF-8!

;!@InstallEnd@!

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:

;!@Install@!UTF-8!
InstallPath="ExtractFolder"
RunProgram="nowait:setup.exe"
GUIFlags="1+32+256+2048"
;!@InstallEnd@!

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.

Comments

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

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

    ReplyDelete
  3. Thank you so much, these few lines are all thats missing from the info provided at.
    http://7zsfx.solta.ru/en/

    Thanks again you made my day!!
    Dec

    ReplyDelete

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 IDEA PhpStorm PyCharm RubyMine WebStorm AppCode CLion 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.

Make Samsung DVD-C350 region-free

Update 2: An anonymous commentator has shown me a way to make Region 1 players (such as DVD-H1080R) region-free by first converting it to Region 3, then applying my region-free hack below. For details, click here or look for a comment by an Anonymous user dated 18 April 2011. Update: The instructions in the original post below did not make the DVD player region-free. Instead it only locked it to region 1. Many thanks to Anonymous who posted the first comment on this post, I now have alternate instructions. Note: If you have edited the numbers menu (see original post) , I suggest you return it to the original settings you had backed up. A modified numbers menu may prevent the instructions below from working properly.

Group, Ungroup and Regroup disabled in Word

I was editing a Microsoft Word document which had a collection of shapes and text boxes grouped together. I wanted to modify some of the shapes, and therefore I had to ungroup them. But when I right-click the group and open the Group menu, all three options namely Group, Ungroup and Regroup are completely disabled or grayed out. I couldn’t figure out what’s wrong. This group of objects is perfectly ungroupable, and I can even select objects within the group. However, Microsoft Word 2007 is not letting me ungroup it. I searched the Internet for a solution, but did not find anything very useful. The closest I came across is this statement: “The type of Text Wrapping doesn't make any difference as long as it isn't In Line with Text.” ( Link here ) Anyway, I changed the text wrapping of the group of objects from ‘In line with Text’ to ‘Tight’ and viola! I could now ungroup it and edit it. The document got a bit messed up when I did so, but after I ungrouped, edited and regro