1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
---|
2 | <HTML>
|
---|
3 | <HEAD>
|
---|
4 | <META http-equiv="Content-Type" content="text/html; charset=Windows-1252">
|
---|
5 | <TITLE>-sfx (Create SFX archive) switch</TITLE>
|
---|
6 | <LINK href="style.css" rel="stylesheet" type="text/css">
|
---|
7 | </HEAD>
|
---|
8 |
|
---|
9 | <BODY>
|
---|
10 |
|
---|
11 | <H1>-sfx (Create SFX archive) switch</H1>
|
---|
12 |
|
---|
13 | <P>Creates self extracting archive.</P>
|
---|
14 |
|
---|
15 | <H4>Syntax</H4>
|
---|
16 |
|
---|
17 | <PRE class="syntax">
|
---|
18 | -sfx[<A class="parameter" href="#SFX_Module">{SFX_Module}</A>]
|
---|
19 | </PRE>
|
---|
20 |
|
---|
21 | <DL>
|
---|
22 | <DT><A name="SFX_Module"></A>{SFX_Module}</DT>
|
---|
23 | <DD>
|
---|
24 | <P>Specifies the SFX module that will be combined with the archive.
|
---|
25 | This module must be placed in the same directory as the 7z.exe.
|
---|
26 | If {SFX_Module} is not assigned, 7-Zip will use standard console
|
---|
27 | SFX module 7zCon.sfx.</P>
|
---|
28 | <TABLE>
|
---|
29 | <TR> <TH width="60">SFX_Module</TH> <TH>Description</TH> </TR>
|
---|
30 | <TR> <TD>7z.sfx</TD> <TD>Windows version.</TD> </TR>
|
---|
31 | <TR> <TD>7zCon.sfx</TD> <TD>Console version.</TD> </TR>
|
---|
32 | <TR> <TD>7zS.sfx</TD> <TD>Windows version for installers.</TD> </TR>
|
---|
33 | <TR> <TD>7zSD.sfx</TD> <TD>Windows version for installers (uses MSVCRT.dll).</TD> </TR>
|
---|
34 | </TABLE>
|
---|
35 | </DD>
|
---|
36 | </DL>
|
---|
37 |
|
---|
38 | <P>
|
---|
39 | All SFX modules are uncompressed. You can use UPX program
|
---|
40 | (http://upx.sourceforge.net)
|
---|
41 | to compresss such modules. After compressing by the UPX program, the size of the
|
---|
42 | sfx module will be reduced to 40-50% of its original size.
|
---|
43 | </P>
|
---|
44 |
|
---|
45 | <H4>SFX modules for installers</H4>
|
---|
46 | <P>SFX modules for installers are included in an external package (7z_extra). You can download
|
---|
47 | these modules from www.7-zip.org. SFX modules for installers (7zS.sfx and 7zSD.sfx)
|
---|
48 | allow you to create your own installation program.
|
---|
49 | Such a module extracts the archive to the user's temp folder, and runs a specified program,
|
---|
50 | and removes the temp files after the program finishes.
|
---|
51 | A self-extracting archive for installers must be created as joining 3 files:
|
---|
52 | SFX_Module, Installer_Config, 7z_Archive.
|
---|
53 | In addition, an optional file, Installer_Config, is allowed. You can use the following command to
|
---|
54 | create an installer self-extracting archive:</P>
|
---|
55 | <PRE class="example">
|
---|
56 | copy /b 7zS.sfx + config.txt + archive.7z archive.exe
|
---|
57 | </PRE>
|
---|
58 |
|
---|
59 | <P>An optimally small installation package size can be achieved,
|
---|
60 | if the installation files are uncompressed before including them in the 7z archive.</P>
|
---|
61 |
|
---|
62 | <P><SPAN class="filename">-y</SPAN> switch for installer module specifies quiet mode extraction.</P>
|
---|
63 |
|
---|
64 | <H4>Installer Config file format</H4>
|
---|
65 | <P>
|
---|
66 | This config file contains commands for the Installer. The file begins with the string
|
---|
67 | <B>;!@Install@!UTF-8!</B> and ends with <B>;!@InstallEnd@!</B>.
|
---|
68 | The file must be written in UTF-8 encoding.
|
---|
69 | The file contains any or all these string pairs:
|
---|
70 | <P>ID_String="Value"</P>
|
---|
71 | <P>
|
---|
72 | <TABLE>
|
---|
73 | <TR> <TH width="60">ID_String</TH> <TH>Description</TH> </TR>
|
---|
74 | <TR> <TD>Title</TD> <TD>Title for messages</TD> </TR>
|
---|
75 | <TR> <TD>BeginPrompt</TD> <TD>Begin Prompt message</TD> </TR>
|
---|
76 | <TR> <TD>Progress</TD> <TD>Value can be "yes" or "no". Default value is "yes".</TD> </TR>
|
---|
77 | <TR> <TD>RunProgram</TD> <TD>Command for executing. Default value is "setup.exe". Substring <B>%%T</B>
|
---|
78 | will be replaced with path to temporary folder, where files were extracted</TD> </TR>
|
---|
79 | <TR> <TD>Directory</TD> <TD>Directory prefix for "RunProgram". Default value is ".\\"</TD> </TR>
|
---|
80 | <TR> <TD>ExecuteFile</TD> <TD>Name of file for executing</TD> </TR>
|
---|
81 | <TR> <TD>ExecuteParameters</TD> <TD>Parameters for "ExecuteFile"</TD> </TR>
|
---|
82 | </TABLE>
|
---|
83 | </P>
|
---|
84 | <P>You may omit any pair.</P>
|
---|
85 |
|
---|
86 | <P>There are two ways to run a installation program: <B>RunProgram</B> and <B>ExecuteFile</B>.
|
---|
87 | Use <B>RunProgram</B>, if you want to run a program from the .7z archive.
|
---|
88 | Use <B>ExecuteFile</B>, if you want to open a document from the .7z archive, or
|
---|
89 | if you want to execute a command from Windows.</P>
|
---|
90 |
|
---|
91 | <P>If you use <B>RunProgram</B>, and if you specify empty directory prefix: <B>Directory</B>="",
|
---|
92 | the system searches for the executable file in the following sequence:</P>
|
---|
93 | <OL>
|
---|
94 | <LI>The directory from which the application (installer) loaded.
|
---|
95 | <LI>The temporary folder, where files were extracted.
|
---|
96 | <LI>The Windows system directory.
|
---|
97 | </OL>
|
---|
98 |
|
---|
99 | <H4>Config file Examples</H4>
|
---|
100 |
|
---|
101 | <PRE class="example">
|
---|
102 | ;!@Install@!UTF-8!
|
---|
103 | Title="7-Zip 4.00"
|
---|
104 | BeginPrompt="Do you want to install the 7-Zip 4.00?"
|
---|
105 | RunProgram="setup.exe"
|
---|
106 | ;!@InstallEnd@!
|
---|
107 | </PRE>
|
---|
108 |
|
---|
109 | <BR>
|
---|
110 |
|
---|
111 |
|
---|
112 | <PRE class="example">
|
---|
113 | ;!@Install@!UTF-8!
|
---|
114 | Title="7-Zip 4.00"
|
---|
115 | BeginPrompt="Do you want to install the 7-Zip 4.00?"
|
---|
116 | ExecuteFile="7zip.msi"
|
---|
117 | ;!@InstallEnd@!
|
---|
118 | </PRE>
|
---|
119 |
|
---|
120 | <BR>
|
---|
121 |
|
---|
122 | <PRE class="example">
|
---|
123 | ;!@Install@!UTF-8!
|
---|
124 | Title="7-Zip 4.01 Update"
|
---|
125 | BeginPrompt="Do you want to install the 7-Zip 4.01 Update?"
|
---|
126 | ExecuteFile="msiexec.exe"
|
---|
127 | ExecuteParameters="/i 7zip.msi REINSTALL=ALL REINSTALLMODE=vomus"
|
---|
128 | ;!@InstallEnd@!
|
---|
129 | </PRE>
|
---|
130 |
|
---|
131 | <H4>Examples</H4>
|
---|
132 |
|
---|
133 | <PRE class="example">
|
---|
134 | 7z a -sfx a.exe *.txt
|
---|
135 | </PRE>
|
---|
136 |
|
---|
137 | <P>adds <SPAN class="filename">*.txt</SPAN> files to self extracting
|
---|
138 | archive <SPAN class="filename">a.exe</SPAN> using the default console SFX module.</P>
|
---|
139 |
|
---|
140 | <PRE class="example">
|
---|
141 | 7z a -sfx7z.sfx a.exe *
|
---|
142 | </PRE>
|
---|
143 |
|
---|
144 | <P>adds all files to self extracting archive <SPAN class="filename">a.exe</SPAN>
|
---|
145 | with module <SPAN class="filename">7z.sfx</SPAN> using windows version of SFX mudule.</P>
|
---|
146 |
|
---|
147 | <H4>Commands that can be used with this switch</H4>
|
---|
148 |
|
---|
149 | <P>
|
---|
150 | <A href="../commands/add.htm">a (Add)</A>,
|
---|
151 | <A href="../commands/delete.htm">d (Delete)</A>,
|
---|
152 | <A href="../commands/update.htm">u (Update)</A>,
|
---|
153 | </P>
|
---|
154 |
|
---|
155 | </BODY>
|
---|
156 | </HTML>
|
---|