707
|
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>Command Line Syntax</TITLE>
|
|
6 <LINK href="style.css" rel="stylesheet" type="text/css">
|
|
7 </HEAD>
|
|
8
|
|
9 <BODY>
|
|
10
|
|
11 <H1>Command Line Syntax</H1>
|
|
12
|
|
13 <PRE class = "syntax">
|
|
14 7z <A href = "commands/index.htm"><command></A> [<A href = "switches/index.htm"><switch></A>...] <base_archive_name> [<arguments>...]
|
|
15 </PRE>
|
|
16 <PRE class = "syntax">
|
|
17 <arguments> ::= <A href = "switches/index.htm"><switch></A> | <wildcard> | <filename> | <list_file>
|
|
18 <A href = "switches/index.htm"><switch></A>::= <switch_symbol><switch_characters>[<option>]
|
|
19 <switch_symbol> ::= '/' | '-'
|
|
20 <list_file> ::= @{filename}
|
|
21 </PRE>
|
|
22
|
|
23
|
|
24 <P>Expressions in square brackets (between '[' and ']') are optional.</P>
|
|
25
|
|
26 <P>Expressions in curly braces ('{' and '}') mean that instead of that
|
|
27 Expression (including braces), the user must substitute some string.</P>
|
|
28
|
|
29 <P>Expression</P>
|
|
30
|
|
31 <PRE class = "syntax">
|
|
32 expression1 | expression2 | ... | expressionN</DT>
|
|
33 </PRE>
|
|
34
|
|
35 <P>
|
|
36 means that any (but only one) from these expressions must be specified.
|
|
37
|
|
38 <P><A href = "commands/index.htm">Commands</A> and
|
|
39 <A href = "switches/index.htm">switches</A> can be entered in upper or lower case.</P>
|
|
40
|
|
41 <P>Command is the first non-switch argument.</P>
|
|
42
|
|
43 <P>The "base_archive_name" must be the first filename on the command line
|
|
44 after the command.</P>
|
|
45
|
|
46 <P>The switches and other filenames can be in any order.</P>
|
|
47
|
|
48 <P>Wildcards or filenames with spaces must be quoted:</P>
|
|
49
|
|
50 <PRE>
|
|
51 "Dir\Program files\*"
|
|
52 Dir\"Program files"\*
|
|
53 </PRE>
|
|
54
|
|
55 <P>Switch options can be combined to save command line length. However, some
|
|
56 switch options take optional string arguments and therefore, must be the
|
|
57 last option in a combined argument token string because 7-Zip accepts the
|
|
58 rest of the argument token as the optional argument.</P>
|
|
59
|
|
60 <P>7-Zip uses wild name matching similar to Windows 95:</P>
|
|
61 <UL>
|
|
62 <LI><B>'*'</B> means a sequence of arbitrary characters.</LI>
|
|
63 <LI><B>'?'</B> means any character.</LI>
|
|
64 </UL>
|
|
65
|
|
66 <P><B>
|
|
67 7-Zip doesn't uses the system wildcard parser. 7-Zip doesn't
|
|
68 follow the archaic rule by which *.* means any file. 7-Zip treats
|
|
69 *.* as matching the name of any file that has an extension. To process all files, you must
|
|
70 use a * wildcard.</B></P>
|
|
71
|
|
72 <P>Examples:</P>
|
|
73 <TABLE border = "0">
|
|
74 <TR><TD>*.txt</TD><TD>means all files with an extension of ".txt"</TD></TR>
|
|
75 <TR><TD>?a*</TD><TD>means all files with a second character of "a"</TD></TR>
|
|
76 <TR><TD>*1*</TD><TD>means all names that contains character "1"</TD></TR>
|
|
77 <TR><TD>*.*.*</TD><TD>means all names that contain two at least "." characters</TD></TR>
|
|
78 </TABLE>
|
|
79
|
|
80
|
|
81 <P>The default wildcard "*" will be used if there is no filename/wildcard in the
|
|
82 command line.</P>
|
|
83
|
|
84 <P>Slash ('\') at the end of a path means a directory. Without a Slash ('\') at
|
|
85 the end of the path, the path can refer either to a file or a directory.
|
|
86
|
|
87
|
|
88 <H2><A name = "ListFile"></A>List file</H2>
|
|
89
|
|
90 <P>You can supply one or more filenames or wildcards for special list files
|
|
91 (files containing lists of files). The filenames in such list file must be
|
|
92 separated by new line symbol(s).</P>
|
|
93
|
|
94 <P>For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding
|
|
95 using <A href = "switches/charset.htm">-scs</A> switch.</P>
|
|
96
|
|
97 <P>Multiple list files are supported.</P>
|
|
98
|
|
99 <P>For example, if the file "listfile.txt" contains the following:</P>
|
|
100
|
|
101 <PRE>
|
|
102 My programs\*.cpp
|
|
103 Src\*.cpp
|
|
104 </PRE>
|
|
105 <P>then the command</P>
|
|
106
|
|
107 <PRE>
|
|
108 7z a -tzip archive.zip @listfile.txt
|
|
109 </PRE>
|
|
110
|
|
111 <P>adds to the archive "archive.zip" all "*.cpp" files from directories "My
|
|
112 programs" and "Src".</P>
|
|
113
|
|
114 <H2><A name = "ListFile"></A>Short and Long File Names</H2>
|
|
115
|
|
116 <P>7-Zip supports short file names (like FILENA~1.TXT) in some cases.
|
|
117 However, it's strongly recommended to use only the real (long) file names.</P>
|
|
118
|
|
119 </BODY>
|
|
120 </HTML>
|