How to Create Self-extracting Archives Without Installing Additional Software

Create Self Extracting Archive Featured

When your friend sends you a compressed file with a relatively unknown format, such as 7z, bz2 etc, don’t you hate it when you need to install additional tool just to be able to extract the content from the archive? This is where self-extracting archive is useful. It allows you to extract archives without additional software. All you have to do is double click the archive and it will automatically extract the files within. While there are lots of applications for you to create self-extracting archive, here are the native tools that come in your OS.

Note:

1. While you can create self-extracting archive in Windows and Linux, the created archive is not cross-platform compatible. You can’t create a self-extracting archive in Windows and expect it to work in Linux. Even in Linux, the archive might not be compatible with each distro. If you are planning to send the self-extracting archive to your friend, make sure you are using the same OS platform as him/her.

2. Self-extracting archive can impose a risk if you are not sure of the content within. Unless you are expecting to receive a self-extracting archive from a trusted source, do not open any self-extracting archive, particularly those you downloaded from some shabby websites.

Also read: 7-Zip vs WinRAR vs WinZIP: The Best Tool for File Compression

Creating self-extracting archive in Windows

Windows comes with this builtin tool – iexpress.exe that allows you to create self-extracting installer. The problem with Microsoft is that it loves to hide these useful nifty tools from the public, so it is unsurprisingly to see that few people have heard of this tool.

In Windows (from XP up to Windows 10), open the “Run” menu and type “iexpress”. Select the “iexpress” program.

Windows10 Run Iexpress

On the first screen, select “Create new Self-Extraction Directive file” and click Next.

Windows10 Iexpress Welcome

On the next screen, select “Extract files only”. This will create an self-extracting archive, rather than an installer.

Windows10 Iexpress Extract Files Only

Continue to click Next and follow the wizard to create the archive. Once completed, you will have an EXE file where you can double-click to extract its content.

windows-self-extracting-exe-file

Creating self-extracting archive in Ubuntu

Ubuntu comes with an Archive Manager that allows you to compress files, but it doesn’t allows you to create a self-extracting archive. To do that, we will have to make use of the unzipsfx command.

For this example, let’s assume that we want to create a self-extracting archive “test” that contains “test.txt”.

1. First, compress the “test.txt” to zip format (using the Archive Manager). You should now have a “test.zip” file that contains “text.txt”.

2. Open a terminal and type:

cat /usr/bin/unzipsfx /path/to/test.zip > /path/to/test

What this command does is to prepend “unzipsfx” to the beginning of “test.zip” and save it as a new file “test”.

3. Next, we are going to change the permission of the file and do adjustment to the self-extracting archive:

chmod 755 /path/to/test
zip -A /path/to/test

That’s it. Whenever you double-click “test”, it will automatically extract the files contained within itself.

Also read: How to Simplify 7z Compression with Bash Aliases

Managing self-extracting archive in Mac

There is no native tool for you to create self-extracting archive in Mac, simply because there is no need to. macOS handles compressed files very well. The default application – Archive Utility – extracts compressed files when you double-click on the archive. In addition, the Unarchiver app supports tons of compression format, so you don’t have to worry about compatibility issue in Mac.

While self-extracting archive has gained a bad name for being the prime source to spread virus, that doesn’t mean it is all bad and nothing good. When used properly, it can be a useful tool as well. In most cases, Windows users will benefit the most from self-extracting archives since the support for various compression formats is still lacking in Windows. However, the EXE file format for the self-extracting archive can be a big turn off for those who are very conscious about security.

Image credit: Zipped folder standing on yellow background by DepositPhotos

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Damien Oh

Damien Oh started writing tech articles since 2007 and has over 10 years of experience in the tech industry. He is proficient in Windows, Linux, Mac, Android and iOS, and worked as a part time WordPress Developer. He is currently the owner and Editor-in-Chief of Make Tech Easier.