7-Zip Command Line Usage and Examples

{lang: 'ar'}

7-Zip is a free file archiver utility available under the terms of GNU Lesser General Public License. It works in Windows 98/ME/NT/2000/XP/Vista /Windows 7 and a port of the command line version is available for Linux and other *ix Operating System’s. 7-Zip is available either as a graphical tool or a command line one. There is also a 64-bit version to support Windows XP 64 bit Operating System and also features integration with Windows Shell.

This article outlines 7-Zip command line usage with simple examples.

Getting Started

  • Download 7-Zip Command Line Version from here
  • Unzip the files
  • Open cmd prompt and change directories to the extracted 7-zip files
  • Enter 7za at the prompt

[important title=”usage”]

An extract of the usage is shown below


7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Usage: 7za <command> [<switches>…] <archive_name> [<file_names>…]

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
-ai[r[-|0]]{@listfile|!wildcard}: Include archives


Usage Examples

Archive files

Archive two files license.txt and readme.txt to an archive called text.7z

[important title=”archive usage”]
C:\software\7za920>7za a text.7z license.txt readme.txt

7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Creating archive text.7z

Compressing  license.txt
Compressing  readme.txt

Everything is Ok



In the above example,

a – add files to archive, text.7z is the archive file name, and license.txt and readme.txt are the files to be archived

List Archive Files

To list archived files, use[highlight]7za l <arhive_file>.7z[/highlight]

[important title=”List archived files”]
C:\software\7za920>7za l text.7z

7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Listing archive: text.7z

Path = text.7z
Type = 7z
Method = LZMA
Solid = +
Blocks = 1
Physical Size = 1284
Headers Size = 180

Date      Time    Attr         Size   Compressed  Name
——————- —– ———— ————  ———————
2010-03-13 03:06:33 ….A         1162         1104  license.txt
2010-11-18 11:09:09 ….A         1254               readme.txt
——————- —– ———— ————  ———————
2416         1104  2 files, 0 folders



Update Files to Archive

Add access.txt to the created archive file, text.7z

[important title=”Update Archive”]

C:\software\7za920>7za u text.7z access.txt

7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18


Updating archive text.7z

Everything is Ok



Test Archive Integrity as follows:[highlight]7za t text.7z[/highlight]

[important title=”Test Archive Integrity”]

C:\software\7za920>7za t text.7z

7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Processing archive: text.7z

Testing     license.txt
Testing     readme.txt
Testing     access.txt

Everything is Ok

Files: 3
Size:       2416
Compressed: 1308



Delete Archive

To delete an archive, use as follows: [highlight]7za d text.7z[/highlight]

[important title=”Delete Archive Files”]
C:\software\7za920>7za d text.7z

7-Zip (A) 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Updating archive text.7z

Everything is Ok

Split Large File into smaller Files

Use the -v switch to split a large file into smaller ones. Let us assume that you have a limitation of 10MB to email files and the archive file size that you have is 11MB. use the -v switch to split the file into two files


C:\software\7-zip>7z a abc.7z text.7z -v9M -v2M

7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18

Creating archive abc.7z

Compressing text.7z

Everything is Ok

In the above example

a stands for archive
– abc.7z is the file name you plan to split the archive into
– text.7z is the large file that you wish to split
-v is the volume, followed by the volume size

here 11MB size is split into two files 9M and 2M respectively

when the files are split, 7zip will use the following naming conventions

abc.7z.002 . . . and so on


Page optimized by WP Minify WordPress Plugin