Creating 7zip Self Extracting Archives
7zip has the ability to create "self extracting archives". This means that you can create an executable that contains both an archive and the code to extract your files, so the target user doesn't need any additional software installed on their machine to open your files.
7zip itself comes with a -sfx command line switch to create these types of archives, but the method I prefer is to create the 7z archive like you normally would, and then concatenate that on the end of the self extractor's binary.
The self extractors are named ending in
The one I'm using is named
Windows users can find
7z.sfx in their 7zip installation at
Unix users can get
7z.sfx (for making windows self extractors) by downloading the 32-bit exe from
7zip's website, and then extracting
7z.sfx from the executable like this:
7z x 7z920.exe 7z.sfx
Then all you need to do is create your 7zip archive like normal:
7z a examplename.7z examplefolder
And then concatenate that with your sfx module.
On Windows, do:
copy /B 7z.sfx+examplename.7z selfextractor.exe
On Unix, do:
cat 7z.sfx examplename.7z > selfextractor.exe
As an added bonus, you can use
upx to compress the sfx itself before concatenating the files.
This will result in an even smaller self extractor.
(You should only do this on your .sfx file once.)
There are also additional sfx modules designed specially for installers. You can read more about them in 7zip's manual.