7-Zip Manual - P (Set Password) Switch - Documentation
7-Zip Manual - P (Set Password) Switch - Documentation
See Also
How to register to 7-Zip
Frequently Asked Questions (FAQ)
See Also
How to register 7-Zip
License for use and distribution
Supported formats
Format Compressing Decompressing Filename Extensions
7z X X 7z
ZIP X X zip
GZIP X X gz gzip tgz
BZIP2 X X bz2 bzip2 tbz2 tbz
TAR X X tar
RAR X rar
CAB X cab
ARJ X arj
Z X z taz
CPIO X cpio
RPM X rpm
DEB X deb
LZH X lzh lha
SPLIT X 001 002 ...
CHM X chm chw hxs
ISO X iso
COMPOUND X msi doc xls ppt
WIM X wim swm
NSIS X exe
ZIP
7-Zip creates fully ZIP compatible archives. Anyone can decompress
these files by any ZIP compatible decompression utility. During
compression 7-Zip can use one of the following ZIP compression
methods:
0 - Store
8 - Deflate
9 - Deflate64
12 - BZip2
The current version of the 7-Zip can extract any files from ZIP archive
that were compressed with one of the following methods:
0 - Store
1 - Shrink
6 - Implode
8 - Deflate
9 - Deflate64
12 - BZip2
Files compressed with other ZIP compression methods can't be extracted
by the current version of the 7-Zip. But these supported methods are the
most popular today, and therefore 7-Zip can decompress most ZIP
archives. To extract files compressed with non-supported methods you
must use some other ZIP utility.
7-Zip supports the Zip64 extension of ZIP format.
The current version of 7-Zip doesn't support Zip multivolume archives.
LZH
7-Zip supports LZH archives only for listing, browsing and
decompressing. 7-Zip supports -lh0-, -lh4-, -lh5-,-lh6- and -lh7- methods.
7z Format
7z is a new archive format, providing a high compression ratio.
The main features of the 7z format:
Open architecture
High compression ratio
Strong AES-256 encryption
Ability to use any compression, conversion or encryption method
Supports files with sizes up to 16000000000 GB
Unicode file names
Solid compression
Archive headers compression
7z has an open architecture, so it can support any new compression
methods.
The following methods currently are integrated into 7z:
Method Description
LZMA Improved and optimized version of LZ77 algorithm
PPMD Dmitry Shkarin's PPMdH with small changes
BCJ Converter for 32-bit x86 executables
BCJ2 Converter for 32-bit x86 executables
BZip2 Standard BWT algorithm
Deflate Standard LZ77-based algorithm
LZMA is the default and general compression method of 7z format. The
main features of the LZMA method:
High compression ratio
Variable dictionary size (up to 4 GB)
Compression speed: about 1 MB/s on 2 GHz CPU
Decompression speed: about 10-20 MB/s on 2 GHz CPU
Small memory requirement for decompression (depends from
dictionary size)
Small code size for decompression: about 5 KB
Supports multi-threading and P4's hyper-threading
The LZMA compression algorithm is very suitable for embedded
applications. If you want to use LZMA code, you can ask for consultation,
custom code programming, and required developer licenses at
www.7-zip.org/support.html
7-Zip also supports encryption with the AES-256 algorithm. This
algorithm uses a cipher key with length of 256 bits. To create the key, 7-
Zip uses a derivation function based on an SHA-256 hash algorithm. A
key derivation function produces a derived key from a text password
defined by the user. To increase the cost of an exhaustive search for
passwords, 7-Zip uses a big number of iterations to produce the cipher
key from the text password.
Tips for selecting password length
Here is an estimate of the time required for an exhaustive password
search attack, when the password is a random sequence of lowercase
Latin letters.
We suppose that one user can check 10 passwords per second and an
organization with a budget of about $1 billion can check 10 billion
passwords per second. We also suppose that the processor in use
doubles its performance every two years; so, each additional Latin letter
of a long password adds about 9 years to an exhaustive key search
attack.
The result is this estimate of the time to succeed in an attack:
Password Length Single User Attack Organization Attack
1 2s 1s
2 1 min 1s
3 30 min 1s
4 12 hours 1s
5 14 days 1s
6 1 year 1s
7 10 years 1s
8 19 years 20 s
9 26 years 9 min
10 37 years 4 hours
11 46 years 4 days
12 55 years 4 months
13 64 years 4 years
14 73 years 13 years
15 82 years 22 years
16 91 years 31 years
17 100 years 40 years
Performance
ZIP Format
Compression ratio results are very dependent upon the data used for the
tests. We compared 7-Zip with some of the leading commercial archivers:
PKZIP 2.04g, WinZip 7.0.
FILE SET: The Canterbury Corpus (11 files totaling 2,810,784 bytes,
popular file set used to compression rates).
Archiver Compressed size Ratio
7-Zip (zip format) 676284 100%
PKZIP 2.04g -ex 726047 107%
WinZip 7.0 (Max) 731499 108%
7z Format
7z is the new archive format, providing a high compression ratio.
FILE SET: The GIMP 1.2.4 for Windows after full installation (127
subfolders, 1304 files totaling 27,128,826 bytes). The GIMP is the GNU
Image Manipulation Program. It can be downloaded from www.gimp.org.
Archiver Compressed size Ratio
7-Zip (7z format) 5445402 100%
WinRAR 3.10 6004155 110%
WinAce 2.3 6242424 115%
CABARC 1.0 6455327 119%
7-Zip (zip format) 9461621 174%
PKZIP 2.50 9842800 181%
GZIP Format
7-Zip provides the best compression ratio for GZIP format. The
compression ratio is equal to its compression ratio for ZIP format (above).
RAR Format
7-Zip provides superior decompression speed for RAR archives. For solid
archives it decompresses only the minimum number of files needed. For
example, consider a solid archive archive.rar containing 100000 files
created by the command:
rar a archive.rar -s100 * -r
In this solid archive, each group of 100 files is compressed as one big
file. To extract one file from that archive, 7-Zip will decompress (in
memory) only some files from one group. As a result, 7-Zip can provide
the combined advantages of solid compression and high speed of
decompression.
Frequently Asked Questions (FAQ)
Can I use 7-Zip in a commercial organization?
Yes, 7-Zip is free software. You can use it on any computer. You don't
need to register or pay for 7-Zip.
Why doesn't the command line version add files that do not have any
extension?
You probably used a *.* wildcard. 7-Zip doesn't use the Windows system
wildcard parser; so, 7-Zip doesn't follow the archaic rule by which *.*
matches every file name. 7-Zip treats *.* as matching only a file name
with an extension. To process all files, you must use a * wildcard or just
omit the wildcard entirely.
In This Section
Plugins
Lists the plugins. For modifying settings of plugins, you must select
the plugin and press the Options button.
Editor Page
Allows you to specify settings for the editor.
Editor
Specifies the path to the editor.
Settings Page
Allows you to specify some settings.
Show .. item
Shows .. item in file list.
Show real file icons
Shows real file icons in file list. If this option is enabled, listing
updates can be slower.
Show system menu
Shows a system context sub-menu in the File menu.
Full row select
When an item is selected, the item and all its subitems are
highlighted.
Show grid lines
Displays gridlines around items and subitems.
Alternative selection mode
If enabled, File Manager keeps selection mark when you move
cursor.
Use large memory pages
If enabled, 7-Zip will try to use large pages. This feature allows an
increase in speed of compression. This may cause 7-Zip to pause
when starting compression, because of allocation of the large pages.
Also, the Windows Task Manager doesn't show the real memory
usage of the program, if 7-Zip uses large pages. This feature works
only on Windows 2003 / XP x64 / Vista. Also you must have
administrator's rights for your system. Recommended size of RAM: 1
GB or more. To install this feature you must run 7-Zip File Manager
at least once, close it and reboot the system.
Language Page
Allows you to change the default language.
Language
Lists the available languages.
Benchmark
This form allows you to measure the performance of your computer.
There are two tests:
1. Compression with LZMA method
2. Decompression with LZMA method
7-Zip
Plugin for manipulating archives.
7-Zip Plugin
7-Zip is a plugin for manipulating archives. It makes all archive files look
like usual folders in File Manager.
Most of the operations with compressed files can be initiated by right-
clicking on files in the File Manager (or in Windows Explorer) and
selecting the appropriate command from a menu.
Using 7-Zip
Opening archive
There are two ways to open an archive file:
If you have the file type associated with 7-Zip, then you can
open the file with 7-Zip by double-clicking the file or by right-
clicking and selecting the Open command.
You can right-click the archive file, point to 7-Zip, and then
click the Open command item.
Extracting archive
There are two ways to extract files from an archive:
To extract all files from an archive right-click the archive file,
point to 7-Zip, and then click the Extract files... command
item.
To extract specific files from an archive, open it by Open
archive with 7-Zip, select the items to extract, and run the
Copy To... command.
Extract Dialog will appear.
Testing archive
To test an archive, right-click the archive file, point to 7-Zip, and then
click the Test archive command item.
Creating and updating files in an archive
For creating or updating an archive file, right-click the file(s) or
folder(s) you want to compress, point to 7-Zip, and then click the
Add to archive... command item. Add to Archive Dialog will appear.
Add to Archive Dialog Box
Allows you to specify options for creating or updating an archive.
Parameters
Archive
Provides a space for you to specify a destination archive name. You
can click "..." button to display "Open" dialog box that you can use to
locate archive.
Archive format
Specifies a format of created archive. Some formats (gzip and bzip2)
do not support compressing more the one file per archive.
Compression level
Specifies compression level. There are 6 levels of compression:
Value Meaning
Store Files will be copied to archive without compression.
Fastest Fastest compression.
Fast Fast compression.
Normal Compression with balanced settings.
Can give a higher compression ratio than Normal level.
Maximum
But it can be slower, and it can require more memory.
Can give a higher compression ratio than Maximum level.
Ultra
But it can be slower, and it can require more memory.
Compression method
Specifies compression method. Each archive format can have its
own compression methods:
Method Description
Default compression method of 7z format. It provides high
LZMA
compression ratio and very fast decompression.
Dmitry Shkarin's PPMdH algorithm with small changes.
PPMd Usually it provides high compression ratio and high speed
for text files.
Standard compression method based on BWT algorithm.
BZip2 Usually it provides high speed and pretty good
compression ratio for text files.
Standard compression method of ZIP and GZip formats.
Compression ratio is not too high. But it provides pretty
Deflate
fast compressing and decompressing. Deflate method
supports only 32 KB dictionary.
Modified version of Deflate algorithm with bigger
Deflate64
dictionary (64KB).
Estimated 7-Zip performance and memory requirements for AMD
Athlon 64 X2 3800+:
Dictionary Compressing Decompressing Memory for
Method Level
Size Speed Speed Compressing
fastest 64 KB 4.5 MB/s 3 MB
fast 1 MB 3 MB/s 10 MB
LZMA normal 16 MB 2 MB/s 15 MB/s 186 MB
maximum 32 MB 1.8 MB/s 376 MB
ultra 64 MB 1.6 MB/s 709 MB
fast 4 MB 1.4 MB/s 6 MB
normal 24MB 1.2 MB/s 26 MB
PPMD
maximum 64 MB 1.0 MB/s 66 MB
ultra 192 MB 0.9 MB/s 194 MB
fast 15 MB/s
3 MB
normal 3.5 MB/s
Deflate 32 KB 40 MB/s
maximum 1.5 MB/s
4MB
ultra 0.4 MB/s
normal 3 MB/s
BZip2 maximum 900 KB 1.2 MB/s 16 MB/s 20 MB
ultra 0.4 MB/s
Dictionary size
Specifies Dictionary size for compression method.
Usually, a higher Dictionary size gives a higher compression ratio.
But compressing can be slower and it can require more memory.
Memory (RAM) usage for LZMA compressing is about 11 times more
than dictionary size. Memory usage for LZMA decompressing is
close to value of dictionary size. Memory usage for PPMd
compressing and decompressing is almost equal to dictionary size.
Word size
Specifies the length of words, which will be used to find identical
sequences of bytes for compression.
Usually for LZMA and Deflate, big Word size gives a little bit better
compression ratio and slower compression process. A big Word size
parameter can significantly increase compression ratio for files which
contain long identical sequences of bytes. For PPMd, the Word size
strongly affects both compression ratio and
compression/decompression speed.
Solid Block size
Specifies the size of a solid block. You can also disable solid mode.
In solid mode all files will be compressed as continuous data blocks.
Usually compressing to a solid archive improves the compression
ratio. You can use this option only for 7z archives. With the current
version of 7z, you can update existing archives only when solid mode
is switched off and the existing archive is non-solid.
Number of CPU threads
Specifies the number of threads for compressing. A big number of
threads can speed up compression speed on Multi-Processor
systems. Sometimes it can increase speed even on single-core CPU.
Split to volumes
{Size}[b | k | m | g]
The first volume will be 10 KB, the second will be 15 KB, and all
others will be 2 MB.
Parameters
Allows you to specify parameters for compression. See the -m
(Method) switch description for more details. Omit the -m prefix (as in
-m switch) when using this dialog box.
Examples
0=PPMd
Options
Specifies compression options:
Option Meaning
Create self-extracting archive. You can use this
option only for 7z archives. Look to -sfx (Create
Create SFX archive
SFX archive) switch description for more details
about SFX modules.
Compress shared Compress files open for writing by another
files applications.
Encryption
Specifies password and encryption options.
Enter password
Specify passord here
Reenter password
Reenter passord here for verification
Show Password
Shows Password
Encryption method
Specifies the encryption method. For 7z format, it can be only
AES-256. For ZIP format you can select ZipCrypto or AES-256.
Use ZipCrypto, if you want to get archive compatible with most
of the ZIP archivers. AES-256 provides stronger encryption, but
now AES-256 is supported only by 7-Zip, WinZip and some
other ZIP archivers.
Encrypt file names
Enables or disables archive header encryption, including file
name encryption.
Extract Dialog Box
Allows you to specify options for extracting files from archive.
Parameters
Extract to
Provides a space for you to specify an output folder. You can click
"..." button to display "Browse for folder" dialog box that you can use
to locate output folder.
Path mode
Specify extract mode:
Value Meaning
Full pathnames Extract files with full pathnames.
Current pathnames Extract files with all relative paths.
No pathnmes Extract files without folder paths.
Overwrite mode
Specify overwrite mode for files that already present on disk:
Value Meaning
Ask
before Ask before overwriting existing files.
overwrite
Overwrite
without Overwrite existing files without prompt.
prompt
Skip
existing Skip extracting of existing files.
files
Rename extracted files, if a file with the same name
Auto
already exists. For example, file document.txt will be
rename
renamed to document_1.txt.
Files
Specifies files for extracting:
Value Meaning
Selected files Extract only files that are selected in the main window.
All files Extract all files.
Password
Specifies a password for encrypted archives.
7-Zip Options Dialog Box
You can change many of the settings that affect the 7-Zip Plugin in the 7-
Zip Options Dialog Box. To access this dialog box, select Options from
the Tools menu, then select the Plugins Page, select 7-Zip plugin, and
press Options.
The options dialog box contains the following pages:
System Page
Folders Page
System Page
Allows you to specify behavior of 7-Zip in Windows Shell.
Working folder
The working folder section allows you to specify a folder which will be
used for temporary archive files:
7-Zip uses temporary archive files for all update operations. So, for speed
reasons, it is recommended that you select the System temp folder
option and select Use for removable drives only check box.
Command Line Version User's Guide
7z.exe is the command line version of 7-Zip. 7z.exe uses 7z.dll from the
7-Zip package. 7z.dll is used by the 7-Zip File Manager also.
7za.exe (a = alone) is a standalone version of 7-Zip. 7za.exe supports
only 7z, cab, zip, gzip, bzip2, Z and tar formats. 7za.exe doesn't use
external modules.
Command Line syntax
Exit Codes
Commands
Switches
Command Line Syntax
7z <command> [<switch>...] <base_archive_name> [<arguments>...]
means that any (but only one) from these expressions must be specified.
Commands and switches can be entered in upper or lower case.
Command is the first non-switch argument.
The "base_archive_name" must be the first filename on the command
line after the command.
The switches and other filenames can be in any order.
Wildcards or filenames with spaces must be quoted:
"Dir\Program files\*"
Dir\"Program files"\*
adds to the archive "archive.zip" all "*.cpp" files from directories "My
programs" and "Src".
Short and Long File Names
7-Zip supports short file names (like FILENA~1.TXT) in some cases.
However, it's strongly recommended to use only the real (long) file
names.
Exit Codes from 7-Zip
7-Zip returns the following exit codes:
Code Meaning
0 No error
Warning (Non fatal error(s)). For example, one or more files were
1
locked by some other application, so they were not compressed.
2 Fatal error
7 Command line error
8 Not enough memory for operation
255 User stopped the process
Command Line Commands
The command is the first non-switch argument on the command line.
Command names are not case sensitive.
See also Command Line Syntax for more details about using the
command line.
Commands quick reference
Command Description
a Add
b Benchmark
d Delete
e Extract
l List
t Test
u Update
x eXtract with full paths
a (Add) command
Adds files to archive.
Examples
7z a -tzip archive.zip subdir\
adds all files and subfolders from folder subdir to archive archive.zip.
7z a -t7z Files.7z *.txt -r
adds all *.txt files from current folder and its subfolders to archive
Files.7z.
See also
Commands: d (Delete), u (Update)
Switches: -u (Update)
b (Benchmark) command
Measures speed of the CPU and checks RAM for errors.
Syntax
b [number_of_iterations] [-mmt{N}] [-md{N}] [-mm={Method}]
Examples
7z b
runs benchmarking.
7z b -mmt1 -md26
Example
7z d archive.zip *.bak -r
See also
Commands: a (Add), u (Update)
Switches: -u (Update)
e (Extract) command
Extracts files from an archive to the current directory or to the output
directory. The output directory can be specified by -o (Set Output
Directory) switch.
This command copies all extracted files to one directory. If you want
extract files with full paths, you must use x (Extract with full paths)
command.
7-Zip will prompt the user before overwriting existing files unless the user
specifies the -y (Assume Yes on all queries) switch. If the user gives a no
answer, 7-Zip will prompt for the file to be extracted to a new filename.
Then a no answer skips that file; or, yes prompts for new filename.
7-Zip accepts the following responses:
Answer Abbr. Action
Yes y
No n
Assume YES for ALL subsequent queries of the same
Always a
class
Assume NO for ALL subsequent queries of the same
Skip s
class
Quit q Quit the program
Abbreviated responses are allowed.
Examples
7z e archive.zip
See also
Commands: x (Extract with full paths)
l (List contents of archive) command
Lists contents of archive.
Examples
7z l archive.zip
Example
7z t archive.zip *.doc -r
Example
7z u archive.zip *.doc
See also
Commands: a (Add), d (Delete),
Switches: -u (Update)
x (Extract with full paths) command
Extracts files from an archive with their full paths in the current directory,
or in an output directory if specified.
See the e (Extract) command description for more deatails.
Examples
7z x archive.zip
extracts all files from the archive archive.zip to the current directory.
7z x archive.zip -oc:\soft *.cpp -r
extracts all *.cpp files from the archive archive.zip to c:\soft folder.
See also
Commands: e (Extract)
Command Line Switches
Syntax
<switch;>::= <switch_symbol><switch_characters>[<option>]
<switch_symbol> ::= '/' | '-'
Syntax
--
Examples
7z t -- -ArchiveName.7z
Syntax
-ai[<recurse_type>]<file_ref>
Parameters
<recurse_type>
Specifies how wildcards and file names in this switch must be used.
If this option is not given, recursion will be not used. For more details
see specification of the -r (Recurse) switch.
<recurse_type> ::= r[- | 0]
<file_ref>
Specifies filenames and wildcards or list file that specify processed
files.
<file_ref> ::= @{listfile} | !{wildcard}
Option Description
{listfile} Specifies name of list file. See List file description.
{wildcard} Specifies wildcard or filename.
Examples
7z t -an -air!*.7z
See also
Switches: -ax (Exclude archives) -an (Disable parsing of archive_name)
-an (Disable parsing of archive_name) switch
Disables parsing of the archive_name field on the command line. This
switch must be used with the -ai (Include archives) switch. If you use a
file list for your archives, you specify it with the -ai switch, so you need to
disable parsing of archive_name field from command line.
Syntax
-an
Examples
7z t -an -ai!*.7z -ax!a*.7z
See also
Switches: -ai (Include archives) -ax (Exclude archives)
-ao (Overwrite mode) switch
Specifies the overwrite mode during extraction, to overwrite files already
present on disk.
Syntax
-ao[a | s | t | u ]
Switch Description
-aoa Overwrite All existing files without prompt.
-aos Skip extracting of existing files.
aUto rename extracting file (for example, name.txt will be
-aou
renamed to name_1.txt).
auto rename existing file (for example, name.txt will be
-aot
renamed to name_1.txt).
Examples
7z x test.zip -aoa
extracts all files from test.zip archive and overwrites existing files without
any prompt.
See also
Switches: -y (assume Yes on all queries),
-ax (Exclude archive filenames) switch
Specifies archives to be excluded from the operation.
Multiple exclude archive switches are supported.
Syntax
-ax[<recurse_type>]<file_ref>
Examples
7z t -an -ai!*.7z -ax!a*.7z
See also
Switches: -ai (Include archives) -an (Disable parsing of archive_name)
-i (Include filenames) switch
Specifies additional include filenames and wildcards.
Multiple include switches are supported.
Syntax
-i[<recurse_type>]<file_ref>
Parameters
<recurse_type>
Specifies how wildcards and file names in this switch must be used.
If this option is not given, then the global value, assigned by the -r
(Recurse) switch will be used. For more details see specification of
the -r (Recurse) switch.
<recurse_type> ::= r[- | 0]
<file_ref>
Specifies filenames and wildcards, or a list file, for files to be
processed.
<file_ref> ::= @{listfile} | !{wildcard}
Option Description
{listfile} Specifies name of list file. See List file description.
{wildcard} Specifies wildcard or filename.
Examples
7z a -tzip src.zip *.txt -ir!DIR1\*.cpp
adds to src.zip archive all *.txt files from current directory and all *.cpp
files from directory DIR1 and from all it's subdirectories.
Commands that can be used with this switch
a (Add), d (Delete), e (Extract), l (List), t (Test), u (Update), x (Extract with
full paths)
See also
Switches: -r (Recurse), -x (Exclude)
-m (Set compression Method) switch
Specifies the compression method.
Syntax
-m<method_parameters>
Zip
Parameter Default Description
x=[0 | 1 | 3 | 5 | 7 | 9 ]
5 Sets level of compression.
Sets a method: Copy, Deflate,
m={MethodID} Deflate
Deflate64, BZip2.
Sets number of Fast Bytes for Deflate
fb={NumFastBytes} 32
encoder.
Sets number of Passes for Deflate
pass={NumPasses} 1
encoder.
d={Size}[b|k|m] 900000 Sets Dictionary size for BZip2
mt=[off | on | {N}] on Sets multithreading mode.
em= Sets a encryption method: ZipCrypto,
ZipCrypto
{EncryptionMethodID} AES128, AES192, AES256
x=[0 | 1 | 3 | 5 | 7 | 9 ]
Sets level of compression. x=0 means Copy mode (no compression).
Deflate / Deflate64 settings:
Level NumFastBytes NumPasses Description
1 Fastest
3 32 1 Fast
5 Normal
7 64 3 Maximum
9 128 10 Ultra
x=1 and x=3 with Deflate method set fast mode for compression.
BZip2 settings:
Level Dictionary NumPasses Description
1 100000 Fastest
3 500000 1 Fast
5 Normal
7 900000 2 Maximum
9 7 Ultra
fb={NumFastBytes}
Sets the number of fast bytes for the Deflate/Deflate64 encoder. It
can be in the range from 3 to 258 (257 for Deflate64). Usually, a big
number gives a little bit better compression ratio and a slower
compression process. A large fast bytes parameter can significantly
increase the compression ratio for files which contain long identical
sequences of bytes.
pass={NumPasses}
Sets number of passes for Deflate encoder. It can be in the range
from 1 to 15 for Deflate and from 1 to 10 for BZip2. Usually, a big
number gives a little bit better compression ratio and a slower
compression process.
d={Size}[b|k|m]
Sets the Dictionary size for BZip2. You must specify the size in bytes,
kilobytes, or megabytes. The maximum value for the Dictionary size
is 900000b. If you do not specify any symbol from set [b|k|m],
dictionary size will be calculated as DictionarySize = 2^Size bytes.
mt=[off | on | {N}]
Sets multithread mode. If you have a multiprocessor or multicore
system, you can get a speed increase with this switch. This option
affects only compression with BZip2, Deflate and Deflate64 methods
and decompression of BZip2 streams. Each thread in the multithread
mode uses 32 MB of RAM for buffering. If you specify {N}, 7-Zip tries
to use N threads.
GZip
GZip uses the same parameters as Zip, but GZip compresses only with
Deflate method.
BZip2
Parameter Default Description
x=[1 | 3 | 5 | 7 | 9 ] 5 Sets level of compression.
pass={NumPasses} 1 Sets number of Passes for Bzip2 encoder.
mt=[off | on | {N}] on Sets multithreading mode.
x=[1 | 3 | 5 | 7 | 9 ]
Sets level of compression
Level NumPasses Description
5 1 Default compression method.
7 2 Maximum compression method.
9 7 Ultra compression method.
pass={NumPasses}
Sets the number of passes. It can be in the range from 1 to 10. The
default value is 1 for normal mode, 2 for maximum mode and 7 for
ultra mode. A bigger number can give a little bit better compression
ratio and a slower compression process.
mt=[off | on | {N}]
Sets multithread mode. If you have a multiprocessor or multicore
system, you can get a speed increase with this switch. If you specify
{N}, for example mt=4, 7-Zip tries to use 4 threads.
x=[0 | 1 | 5 | 7 | 9 ]
Sets level of compression
Level Method Dictionary FastBytes MatchFinder Filter Description
No
0 Copy
compression.
Fastest
1 LZMA 64 KB 32 HC4 BCJ
compressing
Fast
3 LZMA 1 MB 32 HC4 BCJ
compressing
Normal
5 LZMA 16 MB 32 BT4 BCJ
compressing
Maximum
7 LZMA 32 MB 64 BT4 BCJ
compressing
Ultra
9 LZMA 64 MB 64 BT4 BCJ2
compressing
set solid mode with 100 files & 10 MB limits per one solid block.
f=[off | on]
Enables or disables compression filters for executable files: dll, exe,
ocx, sfx, sys. It uses BCJ2 filter in Ultra mode and BCJ filter in other
modes. The default mode is f=on.
hc=[off | on]
Enables or disables archive header compressing. The default mode
is hc=on. If archive header compressing is enabled, some parts of
archive header will be compressed with LZMA method.
he=[off | on]
Enables or disables archive header encryption. The default mode is
he=off.
{N}
Sets order of methods. It is used also to associate parameters with
methods. Numbers must begin from 0. Methods that have smaller
numbers will be used before others.
b{C1}[s{S1}]:{C2}[s{S2}]
Binds output stream S1 in coder C1 with input stream S2 in coder
C2. If stream number is not specified, stream with number 0 will be
used.
Usally coder has one input stream and one output stream. In 7z
some coders can have multiple input and output streams.
For example, BCJ2 encoder has one input stream and four output
streams.
mt=[off | on | {N}]
Sets multithread mode. If you have a multiprocessor or multicore
system, you can get a increase with this switch. 7-Zip supports
multithread mode only for LZMA compression and BZip2
compression / decompression. If you specify {N}, for example mt=4,
7-Zip tries to use 4 threads. LZMA compression uses only 2 threads.
{N}={MethodID}[:param1][:param2] ... [:paramN]
Sets compression method. You can use any number of methods.
The default method is LZMA.
Parameters must be in one of the following forms:
{ParamName}={ParamValue}.
{ParamName}{ParamValue}, if {ParamValue} is number and
{ParamName} doesn't contain numbers.
Supported methods:
MethodID Description
LZMA Algorithm based on LZ algorithm
PPMd Dmitry Shkarin's PPMdH with small changes
BZip2 BWT algorithm
Deflate LZ+Huffman
Copy No compression
Supported filters:
MethodID Description
BCJ converter for x86 executables
BCJ2 converter for x86 executables (version 2)
BC_ARM converter for ARM (little endian) executables
converter for ARM Thumb (little endian)
BC_ARMThumb
executables
BC_IA64 converter for IA-64 executables
BC_PPC_B converter for PowerPC (big endian) executables
BC_SPARC converter for SPARC executables
Filters increase the compression ratio for some types of files. Filters
must be used with one of the compression method (for example, BCJ
+ LZMA).
LZMA
LZMA is an algorithm based on Lempel-Ziv algorithm. It provides very
fast decompression (about 10-20 times faster than compression).
Memory requirements for compression and decompression also are
different (see d={Size}[b|k|m] switch for details).
Parameter Default Description
a=[0|1] 1 Sets compressing mode
d={Size}[b|k|m] 24 Sets Dictionary size
mf={MF_ID} bt4 Sets Match Finder
fb={N} 32 Sets number of Fast Bytes
mc={N} 32 Sets Number of Cycles for Match Finder
lc={N} 3 Sets number of Literal Context bits - [0, 8]
lp={N} 0 Sets number of Literal Pos bits - [0, 4]
pb={N} 2 Set number of Pos Bits - [0, 4]
a=[0|1]
Sets compression mode: 0 = fast, 1 = normal. Default value is 1.
d={Size}[b|k|m]
Sets Dictionary size for LZMA. You must specify the size in bytes,
kilobytes, or megabytes. The maximum value for dictionary size is 1
GB = 2^30 bytes. Default values for LZMA are 24 (16 MB) in normal
mode, 25 (32 MB) in maximum mode (-mx=7) and 26 (64 MB) in
ultra mode (-mx=9). If you do not specify any symbol from the set
[b|k|m], the dictionary size will be calculated as DictionarySize =
2^Size bytes. For decompressing a file compressed by LZMA
method with dictionary size N, you need about N bytes of memory
(RAM) available.
mf={MF_ID}
Sets Match Finder for LZMA. Default method is bt4. Algorithms from
hc* group don't provide a good compression ratio, but they often
work pretty fast in combination with fast mode (a=0). Memory
requirements depend on dictionary size (parameter "d" in table
below).
MF_ID Memory Description
bt2 d*9.5 + 4 MB Binary Tree with 2 bytes hashing.
bt3 d*11.5 + 4 MB Binary Tree with 3 bytes hashing.
bt4 d*11.5 + 4 MB Binary Tree with 4 bytes hashing.
hc4 d*7.5 + 4 MB Hash Chain with 4 bytes hashing.
Note: Your operation system also needs some amount of physical
memory for internal purposes. So keep at least 32MB of physical
memory unused.
fb={N}
Sets number of fast bytes for LZMA. It can be in the range from 5 to
273. The default value is 32 for normal mode and 64 for maximum
and ultra modes. Usually, a big number gives a little bit better
compression ratio and slower compression process.
mc={N}
Sets number of cycles (passes) for match finder. It can be in range
from 0 to 1000000000. Default value is (16 + number_of_fast_bytes /
2) for BT* match finders and (8 + number_of_fast_bytes / 4) for HC4
match finder. If you specify mc=0, LZMA will use default value.
Usually, a big number gives a little bit better compression ratio and
slower compression process. For example, mf=HC4 and mc=10000
can provide almost the same compression ratio as mf=BT4.
lc={N}
Sets the number of literal context bits (high bits of previous literal). It
can be in range from 0 to 8. Default value is 3. Sometimes lc=4 gives
gain for big files.
lp={N}
Sets the number of literal pos bits (low bits of current position for
literals). It can be in the range from 0 to 4. The default value is 0. The
lp switch is intended for periodical data when the period is equal to
2^value (where lp=value). For example, for 32-bit (4 bytes) periodical
data you can use lp=2. Often it's better to set lc=0, if you change lp
switch.
pb={N}
Sets the number of pos bits (low bits of current position). It can be in
the range from 0 to 4. The default value is 2. The pb switch is
intended for periodical data when the period is equal 2^value (where
lp=value).
PPMd
PPMd is a PPM-based algorithm. This algorithm is mostly based on
Dmitry Shkarin's PPMdH source code. PPMd provides very good
compression ratio for plain text files. There is no difference between
compression speed and decompression speed. Memory requirements for
compression and decompression also are the same.
Parameter Default Description
mem={Size}[b|k|m] 24 Sets size of used memory for PPMd.
o={Size} 6 Sets model order for PPMd.
mem={Size}[b|k|m]
Sets the size of memory used for PPMd. You must specify the size in
bytes, kilobytes, or megabytes. The maximum value is 2GB = 2^31
bytes. The default value is 24 (16MB). If you do not specify any
symbol from the set [b|k|m], the memory size will be calculated as
(2^Size) bytes. PPMd uses the same amount of memory for
compression and decompression.
o={Size}
Sets the model order for PPMd. The size must be in the range [2,32].
The default value is 6.
BCJ2
BCJ2 is a Branch converter for 32-bit x86 executables (version 2). It
converts some branch instructions for increasing further compression.
A BCJ2 encoder has one input stream and four output streams:
s0: main stream. It requires further compression.
s1: stream for converted CALL values. It requires further
compression.
s2: stream for converted JUMP values. It requires further
compression.
s3: service stream. It is already compressed.
If LZMA is used, the size of the dictionary for streams s1 and s2 can be
much smaller (512 KB is enough for most cases) than the dictionary size
for stream s0.
Examples
7z a -tzip archive.zip *.jpg -mx0
adds *.exe and *.dll files to solid archive archive.7z using LZMA method
with 2 MB dictionary and BCJ converter. Compression will use
multithreading optimization.
7z a -t7z archive.7z *.exe *.dll -m0=BCJ2 -m1=LZMA:d23 -m2=LZMA:d19 -m3=LZMA:d1
-mb0:1 -mb0s1:2 -mb0s2:3
adds *.exe and *.dll files to archive archive.7z using BCJ2 converter,
LZMA with 8 MB dictionary for main output stream (s0), and LZMA with
512 KB dictionary for s1 and s2 output streams of BCJ2.
7z a -t7z archive.7z *.txt -m0=PPMd
See also
Switches: -t (set Type of archive),
-o (set Output directory) switch
Specifies a destination directory where files are to be extracted.
This switch can be used only with extraction commands.
Syntax
-o{dir_path}
{dir_path}
This is the destination directory path. It's not required to end with a
backslash.
Example
7z x archive.zip -oc:\Doc
extracts all files from the archive.zip archive to the c:\Doc directory.
7z x *.zip -o*
Syntax
-p{password}
{password}
Specifies password.
Examples
7z a archive.7z -psecret -mhe *.txt
Syntax
-r[- | 0]
Switch Description
-r Enable recurse subdirectories.
Disable recurse subdirectories. This option is default for all
-r-
commands.
-r0 Enable recurse subdirectories only for wildcard names.
Examples
7z l archive.zip *.doc -r-
lists all *.doc files that belong to the archived root directory in the
archive.zip archive.
7z a -tzip archive.zip -r src\*.cpp src\*.h
adds all *.cpp and *.h files from directory src and all it's subdirectories to
the archive.zip archive.
See also
Switches: -i (Include), -x (Exclude)
-scs (Set charset for list files) switch
Sets charset for list files.
Syntax
-scs{UTF-8 | WIN | DOS}
UTF-8
Unicode UTF-8 character set.
WIN
Default character set of Windows.
DOS
Default DOS (OEM) character set of Windows.
Example
7z a archive.7z @listfile.txt -scsWIN
compresses files from listfile.txt list, that contains list of files in default
character set of Windows.
Syntax
-seml[.]
[.]
Causes the archive to be deleted after attaching a copy of it to the
email message.
Example
7z a archive.7z -seml a.txt
Syntax
-sfx[{SFX_Module}]
{SFX_Module}
Specifies the SFX module that will be combined with the archive.
This module must be placed in the same directory as the 7z.exe. If
{SFX_Module} is not assigned, 7-Zip will use standard console SFX
module 7zCon.sfx.
SFX_Module Description
7z.sfx Windows version.
7zCon.sfx Console version.
7zS.sfx Windows version for installers.
7zSD.sfx Windows version for installers (uses MSVCRT.dll).
All SFX modules are uncompressed. You can use UPX program
(http://upx.sourceforge.net) to compresss such modules. After
compressing by the UPX program, the size of the sfx module will be
reduced to 40-50% of its original size.
;!@Install@!UTF-8!
Title="7-Zip 4.00"
BeginPrompt="Do you want to install the 7-Zip 4.00?"
ExecuteFile="7zip.msi"
;!@InstallEnd@!
;!@Install@!UTF-8!
Title="7-Zip 4.01 Update"
BeginPrompt="Do you want to install the 7-Zip 4.01 Update?"
ExecuteFile="msiexec.exe"
ExecuteParameters="/i 7zip.msi REINSTALL=ALL REINSTALLMODE=vomus"
;!@InstallEnd@!
Examples
7z a -sfx a.exe *.txt
adds *.txt files to self extracting archive a.exe using the default console
SFX module.
7z a -sfx7z.sfx a.exe *
adds all files to self extracting archive a.exe with module 7z.sfx using
windows version of SFX mudule.
Syntax
-si{file_name}
{file_name}
Specifies a name that will be stored in the archive for the
compressed data. If file_name is not specified, data will be stored
without a name.
Note: The current version of 7-Zip does not support reading of archives
from stdin.
Example
7z a archive.gz -tgzip -siDoc2.txt < Doc.txt
Syntax
-so
Examples
7z x archive.gz -so > Doc.txt
compresses the Doc.txt file to the 7-Zip standard output stream and
writes that stream to archive.gz file.
Syntax
-slp[-]
Switch Description
-slp Enables Large Pages mode.
Disables Large Pages mode. This option is default for all
-slp-
commands.
Large Pages mode increases the speed of compression. However, there
is a pause at the start of compression while 7-Zip allocates the large
pages in memory. If 7-Zip can't allocate large pages, it allocates usual
small pages. Also, the Windows Task Manager doesn't show the real
memory usage of the program, if 7-Zip uses large pages. This feature
works only on Windows 2003 / XP x64 / Vista. Also, it requires
administrator's rights for your system. The recommended size of RAM for
this feature is 1 GB or more. To install this feature, you must run the 7-Zip
File Manager at least once, close it, and then reboot the system.
Your system can hang for several seconds at compressing starting, if you
use -slp mode. So it's not recommended to use -slp mode to compress
small data sets (less than 100 MB).
Example
7z a archive.7z -slp a.iso
Syntax
-slt
Example
7z l -slt archive.7z
Syntax
-scs[-]
Switch Description
-ssc Set case-sensitive mode. It's default for Posix/Linux systems.
-ssc- Set case-insensitive mode. It's default for Windows systems.
Example
7z a archive.7z A*.txt -ssc -r
compresses all A*.txt files from current directory and all it's
subdirectories. That command doesn't compress a*.txt files.
Syntax
-ssw
Example
7z a archive.7z -ssw *.txt
compresses all *.txt files in current folder including files open for writing
by another applications.
Syntax
-t{archive_type}
{archive_type}
Specifies the type of archive. It can be: 7z, zip, gzip, bzip2, or tar. 7z
format is the default.
Note: gzip or bzip2 formats support only one file per archive. If you want
to compress more than one file to these formats, create a tar archive first,
and then compress it with your selected format.
Example
7z a -tzip archive.zip *.txt
adds all *.txt files from current directory to zip archive archive.zip.
Syntax
-u[-]<action_set>[!{new_archive_name}]
<state> ::= p | q | r | x | y | z | w
<action> ::= 0 | 1 | 2 | 3
Parameters
dash (-)
Disables any updates in the base archive.
The term base archive means the archive assigned by
"base_archive_name" on the command line. See Command line
syntax for more details.
{new_archive_name}
Specifies the path name of the new archive to be created. All options
in this switch will refer to this new archive.
If not assigned, then all options in this switch will refer to the base
archive of the command.
<state>
Specifies the state of a particular file to be processed.
<state> ::= p | q | r | x | y | z | w
<action>
Specifies the action for a given <state>.
<action> ::= 0 | 1 | 2 | 3
For each state you can specify one of the three variants of actions:
<action> Description
0 Ignore file (don't create item in new archive for this file)
1 Copy file (copy from old archive to new)
2 Compress (compress file from disk to new archive)
Create Anti-item (item that will delete file or directory
3 during extracting). This feature is supported only in 7z
format.
Remarks
Any update command (such as a (Add), d (Delete), u (Update)) can be
assigned in these terms.
The following table shows action sets for update commands.
command \ <state> p q r x y z w
d (Delete) 1000000
a (Add) 1122222
u (Update) 1121212
Synchronize 1021212
If you don't specify a !{new_archive_name} option, then all options will
refer to the main archive (the archive assigned on the command line after
the 7z command). If you specify !{new_archive_name} option, then 7-Zip
also will create a new archive with the specified name and all options will
refer to that new archive.
Multiple update switches are supported. 7-Zip can create any number of
new archives during one operation.
By default, the action set for each new archive is assigned as the action
set of the main command. There are 3 different action sets for
commands: a (Add), d (Delete), u (Update). You can overload any
<state_action> pair.
Examples
7z u c:\1\exist.7z -u- -up0q3x2z0!c:\1\update.7z *
creates a new archive update.7z and writes to this archive all files from
current directory which differ from files in exist.7z archive. exist.7z
archive will not be changed.
7z u c:\1\exist.7z -up0q3x2z0!c:\1\update.7z * -ms=off
creates a new archive update.7z and writes to this archive all files from
the current directory which differ from files in exist.7z archive.
Note: The current version of 7-Zip cannot change an archive created with
the solid option switched on. To update a .7z archive, you must create
and update the archive in non-solid mode (-ms=off switch).
Syntax
-v{Size}[b | k | m | g]
{Size}[b | k | m | g]
Specifies volume size in Bytes, Kilobytes (1 Kilobyte = 1024 bytes),
Megabytes (1 Megabyte = 1024 Kilobytes) or Gigabytes (1 Gigabyte
= 1024 Megabytes). if you specify only {Size}, 7-zip will treat it as
bytes.
Examples
7z a a.7z *.txt -v10k -v15k -v2m
creates multivolume a.7z archive. First volume will be 10 KB, second will
be 15 KB, and all others will be 2 MB.
Syntax
-w[{dir_path}]
{dir_path}
Specifies the destination directory path. It's not required that a path
end with a backslash.
If <dir_path> is not assigned, then 7-Zip will use the Windows
temporary directory.
Example
7z a -tzip archive.zip *.cpp -wc:\temp
Syntax
-x[<recurse_type>]<file_ref>
Examples
7z a -tzip archive.zip *.txt -x!temp.*
adds to the archive archive.zip all *.txt files, except temp.* files.
See also
Switches: -r (Recurse), -i (Include)
-y (assume Yes on all queries) switch
Disables most of the normal user queries during 7-Zip execution. You can
use this switch to suppress overwrite queries in the e (Extract) and x
(Extract with full paths) commands.
Syntax
-y
Examples
7z x src.zip -y
extracts all files from src.zip archive. All overwrite queries will be
suppressed and files on disk with same filenames as in archive will be
overwritten.
See also
Switches: -ao (Overwrite mode),
Menu Items
Note: 'Grey' refers to the numeric keypad.
File
Menu item Shortcut Description
Submenu with menu commands from
System
system shell
Open Enter Open current item
Open Inside Ctrl+PgDn Open current item as folder inside 7-Zip
Open Outside Shift+Enter Open current item in new window
Edit F4 Open selected item with editor
Rename F2 Rename selected item
Copy To... F5 Copy selected items
Move To... F6 Move selected items
Delete Delete Delete selected items
Split file... Split file to parts
Combine files... Combine files to one file
Comment Ctrl+Z Set comment for file
Calculate
Calculates CRC checksum for files
checksum
Create Folder F7 Create new folder
Create File Shift+F4 Creates new file
Exit Alt+F4 Closes the program.
Edit
Menu Item Shortcut Description
Shift+
Select All Select all items
[Grey +]
Shift+
Deselect All Select all items
[Grey -]
Invert [Grey *] Select / Deselect all items
Selection
Select... [Grey +] Select specified items
Deselect... [Grey -] Deselect specified items
Select by Alt+[Grey Select all items with the same extension as
Type +] current item
Deselect by Alt+[Grey - Deselect all items with the same extension as
Type ] current item
View
Menu Item Shortcut Description
Large Icons Ctrl+1 Displays items by using large icons
Small Icons Ctrl+2 Displays items by using small icons
List Ctrl+3 Displays items in a list
Displays items in a list with detailed
Details Ctrl+4
information about each item
Name Ctrl+F3 Sort items by Name
Type Ctrl+F4 Sort items by Type
Date Ctrl+F5 Sort items by Date
Size Ctrl+F6 Sort items by Size
Unsorted Ctrl+F7 Do not sort items
Flat View Switch Flat view mode for list of files
2 Panels F9 Switch On/Off second panel
Toolbars Menu items for toolbars handling
Open Root
\ Open root computer folder
Folder
Up One
Backspace Open the folder one level up
Level
Folders
Alt+F12 Open folders history
History...
Refresh Ctrl+R Refresh items list
Options
Menu Item Shortcut Description
Options... Open Options dialog box
Favorites
Menu Item Shortcut Description
Add folder to Favorites as Adds folder to favorities
Help
Menu Item Shortcut Description
Contents... F1 Opens 7-Zip Help
About 7-Zip... Opens About dialog box
Miscellaneous commands
Shortcut Description
Tab Switch between panels
Insert Select / Deselect current item
Shift+F10 Display the shortcut menu for the selected items
RightCtrl+0
Alt+0
... Open folder bookmark
RightCtrl+9
Alt+9
Shift+RightCtrl+0
Shift+Alt+0
... Creates folder bookmark
Shift+RightCtrl+9
Shift+Alt+9
Alt+F1 Edit the Folder Address on left panel
Alt+F2 Edit the Folder Address on right panel
Ctrl+[Grey +] Adjust optimal column width for items
Alt+Up Open same folder in other panel
Alt+Left,
Open current folder in other panel
Alt+Right
Keyboard Shortcuts
Key Normal Ctrl Alt Shift
Switch
Tab
panel
F1 Help Left Path
F2 Rename Right Path
F3 View Sort by Name
F4 Edit Sort by Type Exit Create File
F5 Copy Sort by Date
F6 Move Sort by Size
Create
F7 Unsorted
Folder
F9 1/2 Panels
Shortcut
F10 Menu
Menu
F12 Folders History
R: Folder Folder
0-9
Bookmark Bookmark
A Select All
N Create File
R Refresh
Z Comment
Up One
Backspace
Level
Open
Enter Open Properties
outside
Insert Select Item
Delete Delete Item
Page
Open Inside
Down
Page Up Up One Level
Open same
Up folder
Open current
Left
folder
Open current
Right
folder
\ Open root
Grey / Open root
Grey * Select All
Grey + Select Adjust columns Select by Type Select All
Deselect by
Grey - Deselect Deselect All
Type