This is a sfx module for 7-zip that can be used to produce a self extracting 7-zip archive that will extract invisibly, will not overwrite existing files, allows the extract directory to be specified and will also optionally allow a program to be run after the extract.
![]() Sfx Module For 7-Zip
I have a script I use when deploying new machines to install a list of basic applications. One of them is 7zip. I am happy with how it works, I have no problems with the installation itself.
Usage:
The extract directory and program to run after the extract is controlled by binding a UTF8 contiguration file to the self extracting exe file. The file should be created by notepad and should be saved in UTF8 format. This is done by choosing File/Save As from the menu and in the Encoding dropdown choosing UTF-8. The configuration file must be formed as follows:
;!@Install@!UTF-8!
The first line must contain only ';!@Install@!UTF-8!' and the last line must contain only ';!@InstallEnd@!'.
The config file contains string pairs:
ID_String='Value'
You can omit any values.
There are two ways to run program: RunProgram and ExecuteFile. Use RunProgram, if you want to run some program from .7z archive. Use ExecuteFile, if you want to open some document from .7z archive or if you want to execute some command from Windows.
If you use RunProgram and if you specify empty directory prefix: Directory=', the system searches for the executable file in the following sequence:
![]()
If neither RunProgram or ExecuteFIle is specified then the files will be only extracted and no file will be run.
Any in the Path and RunProgram parameters must be escaped with i.e. c:test. An example configuration file named config.txt is included in the download. Environment variables can be specified in the Path parameter i.e. Path='%ramdrv%test'
The self extracting exe is formed from the archive by using the copy command:
copy /b 7zS.sfx + config.txt + archive.7z archive.exe
Learning has never been so easy!
1. Download 7zip from it's homepage : http://www.7-zip.org/ and 7ZSD.sfx from it's homepage : http://7zsfx.solta.ru/en/
2. Copy/paste the following into notepad and save it using 'UTF8' as 'config.txt' :
;!@Install@!UTF-8!
InstallPath='%Programfiles%Program Name' GUIMode='2' ;!@InstallEnd@!
(Change the path to wherever you want it to go, and use double backslashes)
3. Make a 7z archive of the contents inside your 'Program Name' folder.
4. Place the 7z archive, 7ZSD.sfx and config.txt into the same folder and copy/paste the following into a command prompt :
copy /b 7ZSD.sfx + config.txt + archive.7z Setup.exe
(Change 'Setup.exe' to whatever you want)
References
1 Comment
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |