7-Zip

7-Zip: 7z a archive.7z .\folder\ — Windows

Create an archive from a folder.

Availability: Third-party software; install and version dependent.中文

Syntax

7z a archive.7z .\folder\

Examples

Create an archive from a folder.

7z a archive.7z .\folder\

Parameters, options and clauses

Option / clauseDescription
a <archive> <files>Add files to an archive.
-t<type>Choose the archive type, such as 7z or zip.
-mx=<0-9>Choose the compression level.
-p[password]Set an archive password; avoid putting secrets in command history.
-rInclude files from subdirectories.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory