Skip to main content
7-Zip provides extensive command-line switches to control compression, extraction, and archive operations.

Switch Syntax

Switches start with - (dash) or / (forward slash) on Windows:

General Switches

string
Output directory for extracted files
string
Set password for archive
flag
Recurse subdirectories
string
Set archive type (7z, zip, tar, gzip, etc.)
string
Exclude files by pattern
flag
Assume Yes on all queries

Compression Switches

number
Set compression level (0-9)
  • -mx=0 - Copy mode (no compression)
  • -mx=1 - Fastest compression
  • -mx=5 - Normal compression (default)
  • -mx=7 - Maximum compression
  • -mx=9 - Ultra compression
string
Set compression method
  • -m0=LZMA2 - Use LZMA2
  • -m0=LZMA - Use LZMA
  • -m0=PPMd - Use PPMd
  • -m0=BZip2 - Use BZip2
string
Set dictionary size (e.g., 16m, 32m, 64m)
number
Set number of fast bytes (5-273) for LZMA
string
Set solid archive mode (on/off or block size)
number
Set number of CPU threads

Update Switches

string
Update options
  • -u- - Disable archive update
  • -up0q0r2x2y2z0w2 - Complex update mode
string
Set working directory

Archive Handling

string
Create volumes (multi-part archives)
flag
Delete files after compression
string
Create self-extracting archive
flag
Compress locked files

Overwrite Mode

string
Overwrite mode for extraction
  • -aoa - Overwrite all
  • -aos - Skip existing files
  • -aou - Auto rename
  • -aot - Auto rename existing

Listing Options

flag
Show technical information
flag
Disable archiver messages

Examples

Maximum Compression

Fast Compression with Multi-threading

Password-Protected Solid Archive

Split Archive with Exclusions

Switches can be combined in any order. For switches that take values, use = without spaces.

See Also