Skip to main content
7-Zip supports a comprehensive set of command-line operations for working with archives. Each command is specified as a single letter or word following the 7z executable.

Command Syntax

7z <command> [<switches>...] <archive_name> [<file_names>...] [@listfile]

Available Commands

Add (a)

Add files to archive

Update (u)

Update files to archive

Delete (d)

Delete files from archive

Extract (x, e)

Extract files from archive

List (l)

List contents of archive

Test (t)

Test integrity of archive

Benchmark (b)

Benchmark compression performance

Hash (h)

Calculate hash values for files

Rename (rn)

Rename files in archive

Info (i)

Show supported formats and codecs

Command Categories

Archive Creation & Update

  • a (Add) - Create new archives or add files to existing ones
  • u (Update) - Update files in archive with newer versions
  • d (Delete) - Remove files from archives

Archive Extraction

  • x (Extract with full paths) - Extract files preserving directory structure
  • e (Extract) - Extract files to current directory without paths

Archive Information

  • l (List) - Display archive contents and metadata
  • t (Test) - Verify archive integrity without extraction

Utilities

  • b (Benchmark) - Test system compression/decompression performance
  • h (Hash) - Calculate checksums (CRC32, SHA256, etc.)
  • i (Info) - Show supported formats and codecs

Common Switches

Most commands support these common switches:
-o{Directory}
string
Set output directory for extraction
-p{Password}
string
Set password for encrypted archives
-t{Type}
string
Set archive type (7z, zip, tar, etc.)
-r
flag
Recurse subdirectories
-mx{N}
number
Set compression level (0=store, 1=fastest, 5=normal, 9=ultra)
-mmt{N}
number
Set number of CPU threads
-y
flag
Assume Yes on all queries
-bd
flag
Disable progress indicator
-bb{0-3}
number
Set output log level

Exit Codes

7-Zip uses the following exit codes:
CodeMeaning
0Normal (no errors or warnings)
1Warning (non-fatal errors)
2Fatal error
7Command line error
8Not enough memory
255User stopped the process

Examples

Create an archive

7z a archive.7z files/

Extract an archive

7z x archive.7z -o/output/path

List archive contents

7z l archive.7z

Test archive integrity

7z t archive.7z
Command letters are case-insensitive. Both 7z a and 7z A work the same.
Use 7z --help to display the full help message with all commands and switches.

Build docs developers (and LLMs) love