PDF download Download Article
Install software and unpack archives with one double-click
PDF download Download Article

7-Zip is a handy little tool that allows you to compress files into an archive. You can also use 7-Zip to create a self-extracting archive, which is an EXE file that extracts the contained files to a directory when opened. This wikiHow guide will teach you 2 ways to use 7-Zip to create a self-extracting archive in Windows.

Creating Self-Extracting Executables with 7-Zip

  • If you want to create a self-extracting executable that prompts the user to extract the files within, you can use the 7-Zip File Manager app on your PC.
  • In 7-Zip file manager, select the files you want to include, click +Add, and check the box next to "Create SFX archive."
  • If you want your self-extracting executable to run a file, such as an installer or setup file, you'll need to use 7-Zip command line options.
Section 1 of 2:

Creating a Simple Self-Extracting EXE

PDF download Download Article
  1. If you haven't installed 7-Zip yet, you can get it from 7-Zip's download site.
  2. To move up a level in your filesystem, click the icon of a folder with a green up arrow next to the current path. Once you find the folder with the files you want in the archive, hold down Ctrl as you select them, and then click the Add + button at the top.
    Advertisement
  3. To do this, select 7z from the "Archive format" menu, then check the box next to "Create SFX archive" in the "Options" area.
    • The default file name appears at the top of this window. You can change it if you'd like before you continue.
  4. For example, if you want to compress the archive to an even smaller file size, you can select a different 7z compression option.
    • If you want to encrypt the archive with a password, you can select an encryption method and create a password here.[1]
  5. This creates an EXE file containing the files you selected. When a user double-clicks the EXE file, the files will be extracted.
  6. Advertisement
Section 2 of 2:

Creating a Self-Extracting EXE to Install Software

PDF download Download Article
  1. If you want people to be able to double-click the self-extracting archive and have it automatically open an installer or program, you can use this method to create the file. Place the installer or other program file into the directory, along with any other required files.
    • To keep things simple, move the files to an easy-to-access location in your main drive, e.g., C:\My_App.
  2. To do this, you'll need to select all the files in the directory you created, right-click the selection, and choose 7-Zip > Add to Archive. If you're using Windows 11, click Show more options first. This will place the archive in the same directory.
    • Call the 7z file something like "Installer.7z".
  3. To make sure your self-extracting executable actually runs the contained program, you'll need to create a config file and place it in the directory containing the executable and 7z file. Open Notepad or your preferred text editor, then create a config file that looks something like this:[2]
    ;!@Install@!UTF-8!
    Title="My App 4.00"
    BeginPrompt="Do you want to install My App 4.00?"
    RunProgram="setup.exe"
    ;!@InstallEnd@!
    
    • Replace "setup.exe" with the name of the executable you want to launch if the user agrees.
    • See this MIT page for more config file examples.
    • Save this file in the same directory as the files you're including in the executable, and call it config.txt.[3]
  4. To download it directly from the 7-Zip website, go to the download page and click the Download link next to "LZMA SDK: (C, C++, C#, Java)". Once downloaded, extract the files inside.
    • To keep things simple, move the extracted directory to the root of your main drive. E.g., C:\lzma2600.
  5. Here's how:
    • Type environment variables into the Windows search bar.
    • Click Edit the system environment variables.
    • Click the Environment Variables button.
    • In the "User variables" section at the top, select Path and click Edit.
    • Click New and enter the path to the LZMA folder you extracted. For example, C:\lzma2600.
    • Click OK, then OK again.
    • Click Apply.
  6. To do this, type cmd into the Windows search bar, then click Command Prompt.
  7. Here's how:
    • First, cd into the directory containing the files you want to include in the self-extracting executable. E.g., cd C:\My_App.
    • Run this command, but replace "Installer.7z" with the name of the file you created, and "MyInstaller.exe" with the name you want to give the self-extracting executable: copy /b 7zSD.sfx + config.txt + Installer.7z MyInstaller.exe
    • Now, when you double-click your new self-extracting executable, it will run as expected.[4]
  8. Advertisement


Video

Community Q&A

Search
Add New Question
  • Question
    How do I use a specific path automatically?
    Community Answer
    Community Answer
    Using 7Zip, you can't. There are a lot of other archiving programs (such as WinRAR) that can do it, but I would recommend that you just tell people to extract it to the specified directory as it's a much simpler interface.
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Tips

Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement

You Might Also Like

Create Animated GIFs Using PhotoshopCreate Animated GIFs Using Photoshop
Compress Large Files8 Easy Ways to Compress Large Files (Videos, PDFs, & More)
Use 7Zip to Create Multiple Compressed Folders in One GoCreate Multiple Compressed Folders at Once with 7-Zip
Open 7z Files Open 7z Files: PC, Mac, Android, iPhone, ChromeOS
Convert Zip to ExeConvert Zip to Exe
Encrypt a Folder Using 7‐ZipEncrypt a Folder Using 7‐Zip
Extract a Gz File Extract a GZ File on Windows, Linux, Mac, & Mobile
Archive Folders Archive Folders on Windows or Mac: Clear Up Storage Space
Make a Zip File6 Simple Ways to Create a .ZIP File from Files or Folders
Hide a File in an Image FileHide a File in an Image File
Unrar Unrar a File: A Step-by-Step Guide for Any Device
Zip a FolderZip a Folder
Open a Deb File Open a DEB File with 7-Zip on Windows
Open a TAR File on PC or MacEasy Ways to Open TAR, TGZ, and TAR.GZ Files on PC & Mac
Advertisement

About This Article

Stan Kats
Written by:
Professional Technologist
This article was written by Stan Kats and by wikiHow staff writer, Nicole Levine, MFA. Stan Kats is a Professional Technologist and the COO and Chief Technologist for The STG IT Consulting Group in West Hollywood, California. Stan provides comprehensive technology solutions to businesses through managed IT services, and for individuals through his consumer service business, Stan's Tech Garage. Stan holds a BA in International Relations from The University of Southern California. He began his career working in the Fortune 500 IT world. Stan founded his companies to offer an enterprise-level of expertise for small businesses and individuals. This article has been viewed 436,261 times.
How helpful is this?
Co-authors: 14
Updated: March 11, 2026
Views: 436,261
Thanks to all authors for creating a page that has been read 436,261 times.

Reader Success Stories

  • Vishnu M. U.

    Vishnu M. U.

    Mar 7, 2017

    "I had to change compression method from "BZip2" to enable the Create SFX Archive check box. Thanks for..." more
Share your story

Is this article up to date?

Advertisement