If you are in need of a self-extracting executable, check out Window’s built-in compression tool, iexpress.exe, before investing money on a third-party solution like WinZip. Using Windows native compression format, Cabinet (or CAB for short), the compressed files are more like mini-installation programs with the compressor including support for license files, prompt windows, and the launch of other applications when extraction is finished. Configuration and creation of an executable is an easy step-by-step process handled via the IExpress Wizard. At the end of the wizard, the option to save your configuration as a Self Extraction Directive file (or SED for short) is available. These SED files can be loaded at the start of the wizard or supplied as arguments in the Windows command line, negating the need to complete the wizard twice for the same file. The command line support also makes iexpress.exe perfect for automated tasks via batch files or in custom software.
While iexpress is a great and convenient tool, there is also a few downsides one should be aware of before using it as a solution. For example, a default folder to extract to cannot be defined for the executable and must always be entered in manually before extracting. Also, an executable created with the 64-bit version of the application cannot be decompressed on 32 bit architecture.
For a quick tutorial, we will run through the process of using the wizard to create our first executable, saving our chosen configuration as an SED file, and creating a batch file that make uses of this SED configuration to automatically generate all future executables…
1. Run iexpress.exe from the command line. NOTE: This defaults to the 64-bit version on 64 bit Windows. To use the 32 bit, you have to directly run the iexpress.exe file in SystemWOW64.
2. Choose Create new Self Extraction Directive file.
3. Choose the Package purpose you wish to create. Information about each package type can be found in the description window.
4. Enter the Package title.
5. If you want the user to be prompted with a message at the start of the extraction process, choose Prompt user with: and then type in the message you wish to be displayed
6. If you have a license file to display, choose Display a license: and then click Browse to select the license file.
7. Click Add and select the files you wish to be compressed into the package.
8. If you choose Extract files and run an installation command during Package purpose, you will now be prompted to choose an executable to run or enter a Windows command to execute when the executable is done extracting it’s files.
9. Leave Default selected for Show window
10. If you wish for a message to be displayed when the executable is done extracting, click Display message and type in your message.
11. Enter a full path and file name for the executable.
12. Make sure Save Self Extraction Directive (SED) file is selected. Choose a folder to store the SED file.
13. Clicking Next one more time will create your first executable and then save the SED file.
14. Open Notepad.
15. Type the following: iexpress /N c:/pathTo/SEDFile.SED using your own path for your SED file. The /N argument will skip the wizard and force the iexpress to create the executable from the SED.
16. Save the file as iexpress_test.batch.
17. Double click the file to create a new executable. You will notice the previous one, if it has not been removed from it’s folder, will automatically be overwritten.
Command line switches for the executable: http://support.microsoft.com/kb/197147
Example SED File
FriendlyName=KiXtart 4.10 installation with file associations