Factor/Deployment/Single file Deployment on Windows

7-zip can be used to produce a small and unobtrusive single file executable for Windows users. The self-extracting archive will be unzipped into the user's temp directory (%temp%) and a simple configuration file can be used to specify the executable to be run. After the application is closed, all files and folders created in the temp directory are deleted.

  • Download 7-Zip Extras (4.60 or higher) listed as 7z Library, SFXs for installers, Plugin for FAR Manager from http://www.7-zip.org
  • Deploy your application
  • Move the deployed application folder to the 7-zip ExtrasInstaller directory
  • Modify the included cr.bat (example below)
  • Modify the config.txt (example below)
  • (Optional) Change icon of 7zS.sfx or 7zSD.sfx using a resource editor
  • (Optional) Apply UPX compression to deployed exe/dlls and 7-zip sfx file http://upx.sourceforge.net
  • Run modified cr.bat and test generated executable

Note:

  • This method causes two processes to appear in Task Manager
  • Configuration options for config.txt are included in the readme.txt in the Installer directory. This file must be saved as UTF-8.
  • 7zSD.sfx requires the user to have the Microsoft C runtime library installed (msvcrt.dll)
  • Alternative documentation may be found under the -sfx switch documentation in the full help CHM for 7-zip Command Line Version

cr.bat

del archive.7z
del archive.exe
cd "Boids"
..\..\7zr a archive.7z *
move archive.7z ..\
cd ..\
copy /b ..\7zS.sfx + config.txt + archive.7z archive.exe

config.txt

;!@Install@!UTF-8!
Progress="no"
RunProgram="hello-ui.exe"
;!@InstallEnd@!

This revision created on Wed, 26 Aug 2009 01:15:20 by mnestic (updating exe name to vocab that should stick around)