Hier ’ne feine Doku:

https://7-zip.opensource.jp/chm/

Command Line Syntax

7z <command> [<switch>...] <base_archive_name> [<arguments>...]
<arguments> ::= <switch> | <wildcard> | <filename> | [@listfile]
<switch>::= -{switch_name}

Expressions in square brackets (between ‚[‚ and ‚]‘) are optional.

Expressions in curly braces (‚{‚ and ‚}‘) mean that instead of that
Expression (including braces), the user must substitute some string.

Expression

expression1 | expression2 | ... | expressionN

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"\*

Switch options can be combined to save command line length. However, some
switch options take optional string arguments and therefore, must be the
last option in a combined argument token string because 7-Zip accepts the
rest of the argument token as the optional argument.

7-Zip uses wild name matching similar to Windows 95:

  • ‚*‘ means a sequence of arbitrary characters.
  • ‚?‘ means any character.


7-Zip doesn’t use the system wildcard parser. 7-Zip doesn’t
follow the archaic rule by which *.* means any file. 7-Zip treats
*.* as matching the name of any file that has an extension. To process all files, you must
use a * wildcard.

Examples:

*.txt means all files with an extension of „.txt“
?a* means all files with a second character of „a“
*1* means all names that contains character „1“
*.*.* means all names that contain two at least „.“ characters

The default wildcard „*“ will be used if there is no filename/wildcard in the
command line.

Slash (‚\‘) at the end of a path means a directory. Without a Slash (‚\‘) at
the end of the path, the path can refer either to a file or a directory.

List file

You can supply one or more filenames or wildcards for special list files
(files containing lists of files). The filenames in such list file must be
separated by new line symbol(s).

For list files, 7-Zip uses UTF-8 encoding by default. You can change encoding
using -scs switch.

Multiple list files are supported.

For example, if the file „listfile.txt“ contains the following:

 My programs\*.cpp
Src\*.cpp

then the command

 7z a -tzip archive.zip @listfile.txt

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
1 Warning (Non fatal error(s)). For example, one or more files were
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
h Hash
i Show information about supported formats
l List
rn Rename
t Test
u Update
x eXtract with full paths

 


 

Command Line Switches

Syntax

<switch>::= -<switch_characters>[<option>]

On the command line, a switch consists of a switch specifier,
either a dash (-) or a forward slash (/), followed by the name of
the switch. Switch names cannot be abbreviated.

Some switches take an argument after the switch name.
No spaces or tabs are allowed within a switch specification.
Switch names are not case sensitive, but arguments can be case sensitive.

Switch can be used in any place in command line.

See also Command Line Syntax for more details
about using the command line.

Switch quick reference

Switch Description
Stop switches parsing
-ad Show dialog box in GUI version (7zg)
-ai Include archive filenames
-an Disable parsing of archive_name
-ao Overwrite mode
-ax Exclude archive filenames
-bb[0-3] Set output log level
-bd Disable progress indicator
-bs{o|e|p}{0|1|2} Set output stream for output/error/progress
-bt Show execution time statistics
-i Include filenames
-m Set Compression Method
-o Set Output directory
-p Set Password
-r Recurse subdirectories
-sa Set Archive name mode
-scc Set charset for for console input/output
-scrc Set hash function
-scs Set charset for list files
-sdel Delete files after including to archive
-seml Send archive by email
-sfx Create SFX archive
-si Read data from StdIn
-slp Set Large Pages mode
-slt Show technical information
-sni Store NT security information
-sns Store NTFS alternate Streams
-snt[-] Replace trail dots and spaces in file names for Extract operation
-snc Extract file as alternate stream, if there is ‚:‘ character in name
-snr Replace ‚:‘ character to ‚_‘ character in paths of alternate streams
-snh Store hard links as links (WIM and TAR formats only)
-snl Store symbolic links as links (WIM and TAR formats only)
-so Write data to StdOut
-spd Disable wildcard matching for file names
-spe Eliminate duplication of root folder for extract archive command
-spf Use fully qualified file paths
-ssc Set Sensitive Case mode
-sse Stop archive creating, if 7-Zip can’t open some input file
-ssw Compress files open for writing
-stl Set archive timestamp from the most recently modified file
-stm{HexMask} Set CPU thread affinity mask (hexadecimal number).
-stx{Type} Exclude archive type
-t Type of archive
-u Update options
-v Create Volumes
-w Set Working directory
-x Exclude filenames
-y Assume Yes on all queries

Categories:

Schreibe einen Kommentar

Noch keine Reaktion

Neue Themen im Forum
Debian installieren - für Anfänge …Da treten nun einige Fragen auf: Netzwerk einrichten - Domain-N … Weiterlesen
Frage zu GrubDanke @juhu, das war für mich eine reine Verständnisfrage allge … Weiterlesen
Brother Drucker unter LinuxMit der Suche nach „Linux Brother HL-2030“ fand ich zur Seite htt … Weiterlesen
Kategorien im Wiki
WIKI-Beiträge des Monates

Die Beiträge des Monates finden Sie im Kalender unter den blau markierten Tageszahlen.

September 2023
M D M D F S S
 123
45678910
11121314151617
18192021222324
252627282930  
Archive