使用免费的7z命令行压缩和解压缩zip

.\7za.exe x -oOut001  test.zip              // 7z命令行提取(解压缩)test.zip文件到Out001文件夹中
.\7za.exe a -r test.zip log/ readme.txt   // 7z命令行递归压缩log文件夹和readme.txt到test.zip中

//7z命令行递归压缩log文件夹和readme.txt到test.7z文件
//并通过“-mx1”指定压缩级别为1,同理使用-mx9,代表最大压缩级别(压缩级别越高也越慢)
.\7za.exe -r -mx1 a test.7z log/ readme.txt  

完整help信息(-h)如下:

7-Zip (a) [64] 15.14 : Copyright (c) 1999-2015 Igor Pavlov : 2015-12-31

Usage: 7za <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)
  h : Calculate hash values for files
  i : Show information about supported formats
  l : List contents of archive
  rn : Rename files in archive
  t : Test integrity of archive
  u : Update files to archive
  x : eXtract files with full paths

<Switches>
  -- : Stop switches parsing
  -ai[r[-|0]]{@listfile|!wildcard} : Include archives
  -ax[r[-|0]]{@listfile|!wildcard} : eXclude archives
  -ao{a|s|t|u} : set Overwrite mode
  -an : disable archive_name field
  -bb[0-3] : set output log level
  -bd : disable progress indicator
  -bs{o|e|p}{0|1|2} : set output stream for output/error/progress line
  -bt : show execution time statistics
  -i[r[-|0]]{@listfile|!wildcard} : Include filenames
  -m{Parameters} : set compression Method
    -mmt[N] : set number of CPU threads
  -o{Directory} : set Output directory
  -p{Password} : set Password
  -r[-|0] : Recurse subdirectories
  -sa{a|e|s} : set Archive name mode
  -scc{UTF-8|WIN|DOS} : set charset for for console input/output
  -scs{UTF-8|UTF-16LE|UTF-16BE|WIN|DOS|{id}} : set charset for list files
  -scrc[CRC32|CRC64|SHA1|SHA256|*] : set hash function for x, e, h commands
  -sdel : delete files after compression
  -seml[.] : send archive by email
  -sfx[{name}] : Create SFX archive
  -si[{name}] : read data from stdin
  -slp : set Large Pages mode
  -slt : show technical information for l (List) command
  -snh : store hard links as links
  -snl : store symbolic links as links
  -sni : store NT security information
  -sns[-] : store NTFS alternate streams
  -so : write data to stdout
  -spd : disable wildcard matching for file names
  -spe : eliminate duplication of root folder for extract command
  -spf : use fully qualified file paths
  -ssc[-] : set sensitive case mode
  -ssw : compress shared files
  -stl : set archive timestamp from the most recently modified file
  -stm{HexMask} : set CPU thread affinity mask (hexadecimal number)
  -stx{Type} : exclude archive type
  -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

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: 7zip是一款开源的压缩工具,可以实现高压缩比和快速解压的功能。在开始使用之前,我们首先需要对其进行编译。 首先,我们需要下载7zip的源代码,可以在7zip官方网站上找到最新的版本。然后,我们需要安装一个支持CMake的编译环境,例如Visual Studio或MinGW。 接下来,我们将源代码解压缩到一个目录中,并打开命令行界面进入该目录。使用CMake命令生成编译所需的Makefile文件,例如在命令行中输入:cmake . ,然后按下回车键。 生成Makefile文件后,我们可以使用Make命令进行编译。在命令行中输入make,然后按下回车键,编译过程将开始。 编译完成后,我们可以在目录中找到生成的可执行文件,例如7za.exe。现在,我们可以使用该可执行文件来进行文件的压缩解压缩使用7zip的命令行界面非常简单,并且具有丰富的功能。例如,我们可以使用"7za a"命令来创建一个压缩包,以及使用"7za x"命令来解压缩一个压缩包。 除了命令行界面,7zip还提供了一个图形界面的用户界面,可以更加方便地进行操作。 总之,7zip是一款功能强大的开源压缩工具,通过编译和使用它,我们可以实现高效的文件压缩解压缩操作。 ### 回答2: 7-Zip是一个开源的压缩工具,可以通过编译源代码来使用。 首先,需要下载7-Zip软件的源代码。可以从官方网站或者GitHub上获取到最新的源代码压缩包。 解压缩源代码压缩包后,进入解压缩后的文件夹。在命令行中切换到该目录。 在命令行中输入"nmake"命令来编译代码。编译过程可能需要一些时间,取决于你的计算机性能。 如果编译成功,将会生成可执行文件。使用命令行来调用7-Zip,你可以输入"7z"命令来查看可用的命令选项和参数。 在使用7-Zip进行压缩解压缩时,可以使用以下命令格式: 7z <命令> <压缩文件名> <目标文件名> 例如,要将文件夹"test"压缩为一个文件"test.7z",可以使用以下命令: 7z a test.7z test 要解压缩文件"test.7z"到当前目录,可以使用以下命令: 7z x test.7z 7-Zip支持多种格式的压缩解压缩,例如7zzip、rar等。需要注意的是,根据你的编译选项和操作系统的不同,可能会支持不同的格式。 此外,在编译时,你也可以根据需要进行一些自定义设置和配置,例如修改默认的压缩算法、文件类型过滤等。 总的来说,编译和使用7-Zip需要一些基本的命令行操作和对C或C++的编译原理有一定的了解。当你掌握了这些基础知识后,你就可以自由地使用7-Zip来进行压缩解压缩操作了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

piaopiaolanghua

感谢鼓励,再接再厉!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值