Create a 7zip Self Extractor (7zS.sfx or 7z.sfx)

One of easiest silent installations that most anyone can create utilize two free software products. 7-Zip (www.7-zip.org) and Resource Hacker (http://www.angusj.com/resourcehacker/)  Many of the silent installations that are created and found on this site are created using the 7zip compression.  To make a self-extracting silent installation, the utility, Resource Hacker, will need to be applied against the 7z.sfx file. In order to get rid of the dialog box go to Dialog 500 1033.

Procedure to modify the 7z.sfx file

The need to modify the 7z.sfx is no longer necessary and the process has varied since this article was first written in 2006.  As I had tested this process using the 7-zip 18.05 in February 2019. There exists a 7zS.sfx file which is included in the 7-Zip 9.20 (2010-11-18) 8-zip Extra package.  Simply download the 7-Zip 9.20 Extras package and use the 7zS.sfx that exists in that package.

  • Open 7z.sfx with Resource Hacker
    File > Open
  • Go to Dialog > 500 > 1033 from the left column
Resource Hacker

Original Code

500 DIALOG 0, 0, 186, 56
STYLE DS_FIXEDSYS | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Progress"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
  CONTROL "Cancel", 2, BUTTON, BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 115, 35, 64, 14
  CONTROL "Progress1", 1000, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 7, 7, 172, 14
}
  • Replace the original code with the following code

New Code

500 DIALOG 0, 0, 0, 0
STYLE WS_POPUP
CAPTION "Progress"
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
FONT 8, "MS Shell Dlg"
{
}
  • After replacing the code, Compile the Script.
  • File > Save
  • Done

Resource Hacker may also be used to customize the icon.

config.txt

Next, create a config.txt file. This file contains what application will be executed and the method of execution.

Example:

[BEGIN CONFIG.TXT]
;!@Install@!UTF-8!
RunProgram="msistub program.msi /qb-!"
;!@InstallEnd@!
[END CONFIG.TXT]

Note: To launch the following applications:
.EXE – program.exe /switches
.MSI – msistub.exe program.msi /switches
.CMD – startx.exe example.cmd

Create the Self-Extractor

Then use a command window (DOS Prompt) from within the folder that contains the files and execute the snippet of code below from the command line. For example:

archive.7z
config.txt
7zS.sfx

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