Paraglider BartPE Plugins

Sfx Module For 7-Zip

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.

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!
Path="<directory>"
Progress="No"
RunProgram="<Program to run>"
;!@InstallEnd@!

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"

ID_StringDescription
TitleTitle for messages
BeginPromptBegin Prompt message
ProgressValue can be "yes" or "no". Default value is "yes".
RunProgramCommand for executing. Default value is "setup.exe". Substring %%T will be replaced with path to folder, where files were extracted
DirectoryDirectory prefix for "RunProgram". Default value is ".\\"
ExecuteFileName of file for executing
ExecuteParametersParameters for "ExecuteFile"
PathPath to which files are extracted. If omitted then files are extracted to the temporary folder.
SkipIndicates if any existing files should be skipped or deleted. If set to "yes" then existing files will be skipped. Value can be "yes" or "no". Default value is "yes".
WaitIndicates if the extractor should wait for the executed program to exit before it exits. If set to "yes" then it will wait. Value can be "yes" or "no". The default value is "no".

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:

  1. The directory from which the application (installer) loaded.
  2. The folder, where files were extracted.
  3. The Windows system directory.

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