17-Zip for installers 9.38 2------------------------- 3 47-Zip is a file archiver for Windows NT/2000/2003/2008/XP/Vista/7/8/10. 5 67-Zip for installers is part of LZMA SDK. 7LZMA SDK is written and placed in the public domain by Igor Pavlov. 8 9It's allowed to join 7-Zip SFX module with another software. 10It's allowed to change resources of 7-Zip's SFX modules. 11 12 13HOW to use 14----------- 15 167zr.exe is reduced version of 7za.exe of 7-Zip. 177zr.exe supports only format with these codecs: LZMA, LZMA2, BCJ, BCJ2, ARM, Copy. 18 19Example of compressing command for installation packages: 20 217zr a archive.7z files 22 237zSD.sfx is SFX module for installers. 7zSD.sfx uses msvcrt.dll. 24 25SFX modules for installers allow to create installation program. 26Such module extracts archive to temp folder and then runs specified program and removes 27temp files after program finishing. Self-extract archive for installers must be created 28as joining 3 files: SFX_Module, Installer_Config, 7z_Archive. 29Installer_Config is optional file. You can use the following command to create installer 30self-extract archive: 31 32copy /b 7zSD.sfx + config.txt + archive.7z archive.exe 33 34The smallest installation package size can be achieved, if installation files was 35uncompressed before including to 7z archive. 36 37-y switch for installer module (at runtime) specifies quiet mode for extracting. 38 39Installer Config file format 40~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 41Config file contains commands for Installer. File begins from string 42;!@Install@!UTF-8! and ends with ;!@InstallEnd@!. File must be written 43in UTF-8 encoding. File contains string pairs: 44 45ID_String="Value" 46 47ID_String Description 48 49Title Title for messages 50BeginPrompt Begin Prompt message 51Progress Value can be "yes" or "no". Default value is "yes". 52RunProgram Command for executing. Default value is "setup.exe". 53 Substring %%T will be replaced with path to temporary 54 folder, where files were extracted 55Directory Directory prefix for "RunProgram". Default value is ".\\" 56ExecuteFile Name of file for executing 57ExecuteParameters Parameters for "ExecuteFile" 58 59 60You can omit any string pair. 61 62There are two ways to run program: RunProgram and ExecuteFile. 63Use RunProgram, if you want to run some program from .7z archive. 64Use ExecuteFile, if you want to open some document from .7z archive or 65if you want to execute some command from Windows. 66 67If you use RunProgram and if you specify empty directory prefix: Directory="", 68the system searches for the executable file in the following sequence: 69 701. The directory from which the application (installer) loaded. 712. The temporary folder, where files were extracted. 723. The Windows system directory. 73 74 75Config file Examples 76~~~~~~~~~~~~~~~~~~~~ 77 78;!@Install@!UTF-8! 79Title="7-Zip 4.00" 80BeginPrompt="Do you want to install the 7-Zip 4.00?" 81RunProgram="setup.exe" 82;!@InstallEnd@! 83 84 85 86;!@Install@!UTF-8! 87Title="7-Zip 4.00" 88BeginPrompt="Do you want to install the 7-Zip 4.00?" 89ExecuteFile="7zip.msi" 90;!@InstallEnd@! 91 92 93 94;!@Install@!UTF-8! 95Title="7-Zip 4.01 Update" 96BeginPrompt="Do you want to install the 7-Zip 4.01 Update?" 97ExecuteFile="msiexec.exe" 98ExecuteParameters="/i 7zip.msi REINSTALL=ALL REINSTALLMODE=vomus" 99;!@InstallEnd@! 100 101 102 103Small SFX modules for installers 104-------------------------------- 105 1067zS2.sfx - small SFX module (GUI version) 1077zS2con.sfx - small SFX module (Console version) 108 109Small SFX modules support this codecs: LZMA, LZMA2, BCJ, BCJ2, ARM, COPY 110 111Small SFX module is similar to common SFX module for installers. 112The difference (what's new in small version): 113 - Smaller size (30 KB vs 100 KB) 114 - C source code instead of �++ 115 - No installer Configuration file 116 - No extracting progress window 117 - It decompresses solid 7z blocks (it can be whole 7z archive) to RAM. 118 So user that calls SFX installer must have free RAM of size of largest 119 solid 7z block (size of 7z archive at simplest case). 120 121How to use 122---------- 123 124copy /b 7zS2.sfx + archive.7z sfx.exe 125 126When you run installer sfx module (sfx.exe) 1271) It creates "7zNNNNNNNN" temp folder in system temp folder. 1282) It extracts .7z archive to that folder 1293) It executes one file from "7zNNNNNNNN" temp folder. 1304) It removes "7zNNNNNNNN" temp folder 131 132You can send parameters to installer, and installer will transfer them to extracted .exe file. 133 134Small SFX uses 3 levels of priorities to select file to execute: 135 136 1) Files in root folder have higher priority than files in subfolders. 137 2) File extension priorities (from high to low priority order): 138 bat, cmd, exe, inf, msi, cab (under Windows CE), html, htm 139 3) File name priorities (from high to low priority order): 140 setup, install, run, start 141 142Windows CE (ARM) version of 7zS2.sfx is included to 7-Zip for Windows Mobile package. 143 144 145Examples 146-------- 147 1481) To create compressed console 7-Zip: 149 1507zr a c.7z 7z.exe 7z.dll -mx 151copy /b 7zS2con.sfx + c.7z 7zCompr.exe 1527zCompr.exe b -md22 153 154 1552) To create compressed GUI 7-Zip: 156 1577zr a g.7z 7zg.exe 7z.dll -mx 158copy /b 7zS2.sfx + g.7z 7zgCompr.exe 1597zgCompr.exe b -md22 160 161 1623) To open some file: 163 1647zr a h.7z readme.txt -mx 165copy /b 7zS2.sfx + h.7z 7zTxt.exe 1667zTxt.exe 167