热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

7zip在dos命令行用法总结

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

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 [...] [...]
[<@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
archive.gz

Type switch: -tzip
Format: ZIP
Example filename: archive.zip (very compatible)

Type switch: -tbzip2
Format: BZIP2
Example filename: archive.bzip2

Type switch: -ttar
Format: TAR
Example filename: tarball.tar (UNIX and Linux)

Type switch: -tiso
Format: ISO
Example filename: image.iso

Type switch: -tudf
Format: UDF
Example filename: disk.udf

7z a -tiso archive.iso
7z a -tudf archive.udf

7z: executable name
a: add to archive
-tiso or -tudf: format of archive to create
archive.iso or archive.udf: name of archive to create

10. 硬压缩
Switch: -ms=on
Function: Enable solid mode.
This is the default so you won't often need this.

Switch: -ms=off
Function: Disable solid mode.
This is useful when you need to update individual files.
Will reduce compression ratios normally.

11. "-p"设定密码
7z a pw.7z *.txt -pSECRET

12. 其它选项:
Switch: -ssc
Function: Specify case-sensitive mode.
Useful for going between Linux and Windows.
Default: -ssc- on Windows (insensitive)
Default: -scc on Linux (sensitive)


Switch: -ssw
Function: Compress locked files.
Use if: you have problems with opening files.

Switch: -w
Function: Set working directory.
Use when you want to specify temp folders.

Switch: -aoa
Overwrite all destination files.

Switch: -aos
Skip over existing files without overwriting.
Use this for files where the earliest version is most important.

Switch: -aou
Avoid name collisions.
New files extracted will have a number appending to their names.
(You will have to deal with them later.)

Switch: -aot
Rename existing files.
This will not rename the new files, just the old ones already there.
Use when the new files are more important.

7z x test.zip -aoa

7z: use the 7-zip executable
x: use the extract command
test.zip: extract files from this archive

-aoa: overwrite all existing files. risky!


推荐阅读
  • 本文介绍了在Win10上安装WinPythonHadoop的详细步骤,包括安装Python环境、安装JDK8、安装pyspark、安装Hadoop和Spark、设置环境变量、下载winutils.exe等。同时提醒注意Hadoop版本与pyspark版本的一致性,并建议重启电脑以确保安装成功。 ... [详细]
  • 一、Hadoop来历Hadoop的思想来源于Google在做搜索引擎的时候出现一个很大的问题就是这么多网页我如何才能以最快的速度来搜索到,由于这个问题Google发明 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 学习SLAM的女生,很酷
    本文介绍了学习SLAM的女生的故事,她们选择SLAM作为研究方向,面临各种学习挑战,但坚持不懈,最终获得成功。文章鼓励未来想走科研道路的女生勇敢追求自己的梦想,同时提到了一位正在英国攻读硕士学位的女生与SLAM结缘的经历。 ... [详细]
  • 如何去除Win7快捷方式的箭头
    本文介绍了如何去除Win7快捷方式的箭头的方法,通过生成一个透明的ico图标并将其命名为Empty.ico,将图标复制到windows目录下,并导入注册表,即可去除箭头。这样做可以改善默认快捷方式的外观,提升桌面整洁度。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • 本文讨论了使用差分约束系统求解House Man跳跃问题的思路与方法。给定一组不同高度,要求从最低点跳跃到最高点,每次跳跃的距离不超过D,并且不能改变给定的顺序。通过建立差分约束系统,将问题转化为图的建立和查询距离的问题。文章详细介绍了建立约束条件的方法,并使用SPFA算法判环并输出结果。同时还讨论了建边方向和跳跃顺序的关系。 ... [详细]
  • Android Studio Bumblebee | 2021.1.1(大黄蜂版本使用介绍)
    本文介绍了Android Studio Bumblebee | 2021.1.1(大黄蜂版本)的使用方法和相关知识,包括Gradle的介绍、设备管理器的配置、无线调试、新版本问题等内容。同时还提供了更新版本的下载地址和启动页面截图。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 解决Cydia数据库错误:could not open file /var/lib/dpkg/status 的方法
    本文介绍了解决iOS系统中Cydia数据库错误的方法。通过使用苹果电脑上的Impactor工具和NewTerm软件,以及ifunbox工具和终端命令,可以解决该问题。具体步骤包括下载所需工具、连接手机到电脑、安装NewTerm、下载ifunbox并注册Dropbox账号、下载并解压lib.zip文件、将lib文件夹拖入Books文件夹中,并将lib文件夹拷贝到/var/目录下。以上方法适用于已经越狱且出现Cydia数据库错误的iPhone手机。 ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 动态规划算法的基本步骤及最长递增子序列问题详解
    本文详细介绍了动态规划算法的基本步骤,包括划分阶段、选择状态、决策和状态转移方程,并以最长递增子序列问题为例进行了详细解析。动态规划算法的有效性依赖于问题本身所具有的最优子结构性质和子问题重叠性质。通过将子问题的解保存在一个表中,在以后尽可能多地利用这些子问题的解,从而提高算法的效率。 ... [详细]
  • Ubuntu 9.04中安装谷歌Chromium浏览器及使用体验[图文]
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
author-avatar
谷智精源
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有