Home | History | Annotate | Download | only in DOC
      1 7-Zip for installers 9.38
      2 -------------------------
      3 
      4 7-Zip is a file archiver for Windows NT/2000/2003/2008/XP/Vista/7/8/10. 
      5 
      6 7-Zip for installers is part of LZMA SDK.
      7 LZMA SDK is written and placed in the public domain by Igor Pavlov.
      8 
      9 It's allowed to join 7-Zip SFX module with another software.
     10 It's allowed to change resources of 7-Zip's SFX modules.
     11 
     12 
     13 HOW to use
     14 -----------
     15 
     16 7zr.exe is reduced version of 7za.exe of 7-Zip.
     17 7zr.exe supports only format with these codecs: LZMA, LZMA2, BCJ, BCJ2, ARM, Copy.
     18 
     19 Example of compressing command for installation packages:
     20 
     21 7zr a archive.7z files
     22 
     23 7zSD.sfx is SFX module for installers. 7zSD.sfx uses msvcrt.dll.
     24 
     25 SFX modules for installers allow to create installation program. 
     26 Such module extracts archive to temp folder and then runs specified program and removes 
     27 temp files after program finishing. Self-extract archive for installers must be created 
     28 as joining 3 files: SFX_Module, Installer_Config, 7z_Archive. 
     29 Installer_Config is optional file. You can use the following command to create installer 
     30 self-extract archive:
     31 
     32 copy /b 7zSD.sfx + config.txt + archive.7z archive.exe
     33 
     34 The smallest installation package size can be achieved, if installation files was 
     35 uncompressed before including to 7z archive.
     36 
     37 -y switch for installer module (at runtime) specifies quiet mode for extracting.
     38 
     39 Installer Config file format
     40 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     41 Config file contains commands for Installer. File begins from string 
     42 ;!@Install@!UTF-8! and ends with ;!@InstallEnd@!. File must be written 
     43 in UTF-8 encoding. File contains string pairs: 
     44 
     45 ID_String="Value"
     46 
     47 ID_String          Description 
     48 
     49 Title              Title for messages 
     50 BeginPrompt        Begin Prompt message 
     51 Progress           Value can be "yes" or "no". Default value is "yes". 
     52 RunProgram         Command for executing. Default value is "setup.exe". 
     53                    Substring %%T will be replaced with path to temporary 
     54                    folder, where files were extracted 
     55 Directory          Directory prefix for "RunProgram". Default value is ".\\" 
     56 ExecuteFile        Name of file for executing 
     57 ExecuteParameters  Parameters for "ExecuteFile" 
     58 
     59 
     60 You can omit any string pair.
     61 
     62 There are two ways to run program: RunProgram and ExecuteFile. 
     63 Use RunProgram, if you want to run some program from .7z archive. 
     64 Use ExecuteFile, if you want to open some document from .7z archive or 
     65 if you want to execute some command from Windows.
     66 
     67 If you use RunProgram and if you specify empty directory prefix: Directory="", 
     68 the system searches for the executable file in the following sequence:
     69 
     70 1. The directory from which the application (installer) loaded. 
     71 2. The temporary folder, where files were extracted. 
     72 3. The Windows system directory. 
     73 
     74 
     75 Config file Examples
     76 ~~~~~~~~~~~~~~~~~~~~
     77 
     78 ;!@Install@!UTF-8!
     79 Title="7-Zip 4.00"
     80 BeginPrompt="Do you want to install the 7-Zip 4.00?"
     81 RunProgram="setup.exe"
     82 ;!@InstallEnd@!
     83 
     84 
     85 
     86 ;!@Install@!UTF-8!
     87 Title="7-Zip 4.00"
     88 BeginPrompt="Do you want to install the 7-Zip 4.00?"
     89 ExecuteFile="7zip.msi"
     90 ;!@InstallEnd@!
     91 
     92 
     93 
     94 ;!@Install@!UTF-8!
     95 Title="7-Zip 4.01 Update"
     96 BeginPrompt="Do you want to install the 7-Zip 4.01 Update?"
     97 ExecuteFile="msiexec.exe"
     98 ExecuteParameters="/i 7zip.msi REINSTALL=ALL REINSTALLMODE=vomus"
     99 ;!@InstallEnd@!
    100 
    101 
    102 
    103 Small SFX modules for installers
    104 --------------------------------
    105 
    106 7zS2.sfx     - small SFX module (GUI version)
    107 7zS2con.sfx  - small SFX module (Console version)
    108 
    109 Small SFX modules support this codecs: LZMA, LZMA2, BCJ, BCJ2, ARM, COPY
    110 
    111 Small SFX module is similar to common SFX module for installers.
    112 The 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 
    121 How to use
    122 ----------
    123 
    124 copy /b 7zS2.sfx + archive.7z sfx.exe
    125 
    126 When you run installer sfx module (sfx.exe)
    127 1) It creates "7zNNNNNNNN" temp folder in system temp folder.
    128 2) It extracts .7z archive to that folder
    129 3) It executes one file from "7zNNNNNNNN" temp folder. 
    130 4) It removes "7zNNNNNNNN" temp folder
    131 
    132 You can send parameters to installer, and installer will transfer them to extracted .exe file.
    133 
    134 Small 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 
    142 Windows CE (ARM) version of 7zS2.sfx is included to 7-Zip for Windows Mobile package.
    143 
    144 
    145 Examples
    146 --------
    147 
    148 1) To create compressed console 7-Zip:
    149 
    150 7zr a c.7z 7z.exe 7z.dll -mx
    151 copy /b 7zS2con.sfx + c.7z 7zCompr.exe
    152 7zCompr.exe b -md22
    153 
    154 
    155 2) To create compressed GUI 7-Zip:
    156 
    157 7zr a g.7z 7zg.exe 7z.dll -mx
    158 copy /b 7zS2.sfx + g.7z 7zgCompr.exe
    159 7zgCompr.exe b -md22
    160 
    161 
    162 3) To open some file:
    163 
    164 7zr a h.7z readme.txt -mx
    165 copy /b 7zS2.sfx + h.7z 7zTxt.exe 
    166 7zTxt.exe
    167