7z Compression and Decompression commands

Source: Internet
Author: User

When writing a lot of tools, the 7z command may be used to compress and decompress the operation. Here are two more commonly used operations: compression, decompression.

Enter the 7z command in the DOS window to display the details of the 7z usage parameters:

7-zip 9.10 Beta Copyright (c) 1999-2009 Igor Pavlov 2009-12-22

usage:7z <command> [<switches> ...] <archive_name> [<file_names> ...]
[< @listfiles ...;]

<Commands>
A:add Files to archive
B:benchmark
D:delete Files from archive
E:extract files from archive (without using directory names)
L:list contents of Archive
T:test Integrity of Archive
U:update Files to archive
X:extract files with full paths
<Switches>
-ai[r[-|0]]{@listfile |! Wildcard}: Include Archives
-ax[r[-|0]]{@listfile |! Wildcard}: EXclude Archives
-bd:disable Percentage Indicator
-i[r[-|0]]{@listfile |! Wildcard}: Include filenames
-m{parameters}: Set compression Method
-o{directory}: Set Output Directory
-p{password}: Set Password
-R[-|0]: Recurse subdirectories
-scs{utf-8 | WIN | DOS}: Set CharSet for list files
-sfx[{name}]: Create SFX Archive
-si[{name}]: Read data from stdin
-slt:show Technical information for L (List) command
-so:write data to stdout
-ssc[-]: Set sensitive case mode
-ssw:compress Shared files
-t{type}: Set Type of archive
-u[-][p#][q#][r#][x#][y#][z#][!newarchivename]: Update options
-V{SIZE}[B|K|M|G]: Create volumes
-w[{path}]: Assign work directory. Empty path means a temporary directory
-x[r[-|0]]]{@listfile |! Wildcard}: EXclude filenames
-y:assume Yes on all queries

Required Parameters: The most commonly used commands are a (compressed), X (decompression), other commands such as Delete, extract out of the directory structure is not preserved, generally do not use.

Optional Parameters: The most common is-t{type}

The default value for type is 7z, and there are other such as:

Type Format Example filename
-t7z 7Z archive.7z (default)
-tgzip Gzip Archive.gzip,archive.gz
-tzip Zip Archive.zip (compatible)
-tbzip2 BZIP2 Archive.bzip2
-ttar TAR Tarball.tar (Unix/linux)
-tiso Iso Image.iso (may not be supported)
-tudf Udf Disk.udf

Commonly used is-t{type} and-R,-O,-y

Decompression command: 7z x-tzip-y Xx-13.zip (unzip to the current directory, if you want to change the output directory, need additional use-O)

Compression command: 7z a-tzip-r xx.zip a\* b\*

Compress directory A, directory B, into a xx.zip

For more details on the parameters, please refer to here: Http://www.dotnetperls.com/7-zip-examples

In the Windows 64-bit operating system, in addition to the need for 7z.exe, but also need 7z.dll, I will pack them as a zip file, or you may encounter the above error when you execute the command. You can download it directly from here >>

7z Compression and Decompression commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.