Home > Scripts, Software Packaging, Tips and Tricks > Create a 7zip Self Extractor (7zS.sfx or 7z.sfx)

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

May 11th, 2006

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

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

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.

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

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
Comments are closed.