Using 7zip to create a SelF eXtracting archive (SFX) with high compression

7zip is a nice Windows command line tool, to create or to extract archives.

It supports many formats.

Download 7zip from here:

http://www.7-zip.org

Command line to create a SelF eXtracting executable (SFX):

(uses 7z format for high compression, and multi threading for speed)


7z a  -ms -mmt -t7z -sfx  mySFX.exe   myInputFile


Extracting the SFX:


To extract the SFX, simply execute it as you would any command line tool.  This works OK from the command line on Windows XP:


 > mySFX.exe
...
...


Alternative to SFX - ship 7za.exe with the archive


An alternative to using self extracting archives, is to ship a 7z archive file, and with it the self contained form of 7-zip, which is named 7za.exe.


You can download 7za.exe as '7-Zip Command Line Version' from the 7-Zip site.


You can decompress an archive file myArchive.7z using 7za.exe like this:


7za.exe x -y myArchive.7z

Comments