首页 > 编程 > BAT > 正文

7zip在dos命令行用法总结

2020-06-09 13:52:56
字体:
来源:转载
供稿:网友

7zip功能很强大,你只要两个文件,7z.exe以及7z.dll就可以使用命令行工作了。

安装完7zip软件后,在其安装目录下找到7z.exe和7z.dll两个文件,将其复制到C:/Windows/System32便可以在DOS直接应用。

常用方式:

-o (set Output directory) switch
Specifies a destination directory where files are to be extracted.

This switch can be used only with extraction commands.

Syntax-o{dir_path} {dir_path} This is the destination directory path. It's not required to end with a backslash. If you specify * in {dir_path}, 7-Zip substitutes that * character to archive name.
Example 7z x archive.zip -oc:/Doc
extracts all files from the archive.zip archive to the c:/Doc directory.

7z x *.zip -o*
extracts all *.zip archives to subfolders with names of these archives.

Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]

1. "a",添加文件
7z a -t7z files.7z *.txt

2. "d", 删除文件
7z d archive.zip *.bak -r
从zip文件中删除所有的*.bak文件

3. "e", 解压缩
7z e archive.zip

4. "l", 列出文件
7z l archive.zip

5. "t", 测试完整性
7z t archive.zip *.doc -r

6. "u", 更新
7z u archive.zip *.d

7. "x", 与e相同,但保留全路径

8. "m", 指定优化级别
Compression switch: -mx0
What it means: Don't compress at all.
Is called "copy mode."

Compression switch: -mx1
What it means: Very low compression.
It is called "fastest" mode.

Compression switch: -mx3
What it means: Fast compression mode.
Will set various parameters automatically.

Compression switch: -mx5
What it means: Same as above, but "normal."

Compression switch: -mx7
What it means: "maximum" compression.

Compression switch: -mx9
What it means: "ultra" compression.
(You probably want to use this.)

9. "-m"选项:
Switch: -mfb
Function: Specifies # of fast bytes.
Sometimes help with very "sparse" files.
Don't bother.

Switch: -mpass
Function: Number of passes for deflate compression.
Don't bother with this.
Automatically set with levels.

Switch: -md
Function: Specifies dictionary size.
Automatically set, so don't bother.

Switch: -mmt
Function: Enable multithreading.
Use if: you have quad-core and a really huge archive.
Specify "on" or "off".
This may be enabled by default; check the help file.

10. "-t"选项
指定压缩文件类型
Type switch: -t7z
Format: 7Z
Example filename: archive.7z (default option)

Type switch: -tgzip
Format: GZIP
Example filename: archive.gzip

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表