Skip to main content
Self-extracting archives (SFX) are executable files that can extract their contents without requiring 7-Zip or any other archiver to be installed.

What are SFX Archives?

An SFX archive combines:
  • A small executable stub (SFX module)
  • The compressed archive data
  • Optional configuration and GUI
The result is a .exe file (Windows) or executable binary (Linux/macOS) that can extract itself.

Creating SFX Archives

Basic SFX Archive

With Custom SFX Module

SFX Module Types

7-Zip includes three SFX modules:

1. Console SFX (7zCon.sfx)

Location: CPP/7zip/Bundles/SFXCon/
Features:
  • Command-line interface
  • No GUI dependencies
  • Small size (~100 KB)
  • Ideal for scripts and automation

2. Windows GUI SFX (7z.sfx)

Location: CPP/7zip/Bundles/SFXWin/
Features:
  • Graphical interface
  • User-friendly extraction dialog
  • Size: ~150 KB
  • Best for end-user distribution

3. Installer SFX (7zS.sfx)

Location: CPP/7zip/Bundles/SFXSetup/
Features:
  • Installation wizard interface
  • Run commands after extraction
  • Set extraction path
  • Overwrite prompts
  • Best for software installers

SFX Configuration

Create a configuration file to customize SFX behavior:

config.txt

Create SFX with Config

Or use 7-Zip:

Configuration Options

string
Window title for installer
string
Message shown before extraction
string
Show progress dialog (“yes” or “no”)
string
Program to run after extraction
string
Default extraction directory
string
Text in extraction dialog
string
How to handle existing files
  • 0 - Ask user
  • 1 - Overwrite without prompt
  • 2 - Skip existing files
string
Installation path with user prompt

Path Variables

Use special variables in paths:

Examples

Software Installer

Silent Extraction

User-Interactive Installer

Creating Multi-Platform SFX

Linux/macOS SFX

Create self-extracting shell archives:

sfx_stub.sh

SFX Compression Options

Use maximum compression for SFX archives:

SFX Module Source Code

The SFX modules are built from:
  • Console SFX: CPP/7zip/Bundles/SFXCon/
    • Main file: SfxCon.cpp
    • Size: ~100 KB
    • No GUI dependencies
  • GUI SFX: CPP/7zip/Bundles/SFXWin/
    • Main file: SfxWin.cpp
    • Uses Windows Common Controls
    • Size: ~150 KB
  • Setup SFX: CPP/7zip/Bundles/SFXSetup/
    • Main file: ExtractCallback.cpp, ExtractEngine.cpp
    • Full installer functionality
    • Size: ~160 KB

Building Custom SFX Modules

You can build custom SFX modules from source:

Best Practices

Use SFX archives for:
  • Software distribution
  • Installation packages
  • Sending to users without 7-Zip
  • One-click extraction
Considerations:
  • SFX files are larger (adds ~100-160 KB)
  • Some antivirus software may flag SFX files
  • Test on target systems
  • Sign executables to avoid security warnings

Code Signing

Sign SFX executables to avoid security warnings:

Troubleshooting

SFX Won’t Run

  • Check compatibility: Ensure SFX module matches target OS
  • Antivirus: Whitelist or sign the executable
  • Permissions: Run as administrator if needed

Custom Module Not Found

See Also