首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >7z压缩与解压命令

7z压缩与解压命令

作者头像
meteoric
发布2018-11-19 18:05:58
发布2018-11-19 18:05:58
12.1K0
举报
文章被收录于专栏:游戏杂谈游戏杂谈

在写很多工具的时候,可能会用到7z命令来进行压缩与解压操作。这里记录二个比较常用的操作:压缩、解压。

在dos窗口下输入7z命令,会显示7z的使用参数详情:

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

必选参数:最常用的命令有a(压缩)、x(解压),其它的命令诸如删除,解压出来不保留目录结构这种,一般情况下都用不到。

可选参数:最常用的就是-t{Type}

Type默认值为7z,还有其它的如:

Type

Format

Example filename

-t7z

7Z

archive.7z(默认)

-tgzip

GZIP

archive.gzip,archive.gz

-tzip

ZIP

archive.zip(兼容)

-tbzip2

BZIP2

archive.bzip2

-ttar

TAR

tarball.tar(Unix/Linux)

-tiso

ISO

image.iso(可能不支持)

-tudf

UDF

disk.udf

常用的就是-t{Type}以及-r、-o、-y

解压命令:7z x -tzip -y xx-13.zip (解压到当前目录,如需改变输出目录,需要附加使用-o)

压缩命令:7z a -tzip -r xx.zip a\* b\*

将目录a、目录b,压缩成一个xx.zip

更多参数的详情,可以参考这里:http://www.dotnetperls.com/7-zip-examples

在Windows的64位操作系统下,除需要7z.exe外,还需要7z.dll,我将他们打包为一个zip文件,否则你执行命令的时候可能会遇到上面的错误。你可以从这里直接下载>>

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2015-07-29 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档