7z之使用方式

CPP使用命令行解压7z文件 在项目中如果遇到7z文件时,可以使用命令行的方式解压处理。 首先,7z命令行的使用可以参考这篇文章:https://www.cnblogs.com/Frank99/p/5951177.html。 然后我们可以在代码中使用ShellExecuteEx来调用7z命令行解压文件,示例代码如下: SHELLEXECUTEINFO ShExecInfo; ShExec... 阅读详情

官网地址:

http://sparanoid.com/lab/7z/sdk.html


c++下建议编译:

lzma938\CPP\7zip\Bundles\Alone7z\Alone.dsw

生成7zr.exe,使用方式如下


命令:

NAME
       7zr - A file archiver with highest compression ratio

SYNOPSIS
       7zr [adeltux] [-] [SWITCH] <ARCHIVE_NAME> <ARGUMENTS>...

DESCRIPTION
       7-Zip  is  a  file  archiver  with  the  highest compression ratio. The
       program supports 7z (that implements LZMA compression algorithm),  ZIP,
       CAB,  ARJ,  GZIP,  BZIP2,  TAR,  CPIO, RPM and DEB formats. Compression
       ratio in the new 7z format is 30-50% better than ratio in ZIP format.

       7zr is a stand-alone executable. 7zr handles less archive formats  than
       7z,  but does not need any others. 7zr is a "light-version" of 7za that
       only handles 7z archives.

FUNCTION LETTERS
       a      Add

       d      Delete

       e      Extract

       l      List

       t      Test

       u      Update

       x      eXtract 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

       -l     don’t store symlinks; store the files/directories they point  to
              (CAUTION : the scanning stage can never end because of recursive
              symlinks like ’ln -s .. ldir’)

       -m{Parameters}
              Set             Compression             Method              (see
              /usr/share/doc/p7zip/DOCS/MANUAL/switches/method.htm  for a list
              of methods)

       -mhe=on|off
              7z format only : enables or disables archive  header  encryption
              (Default : off)

       -o{Directory}
              Set Output directory

       -p{Password}
              Set Password

       -r[-|0]
              Recurse  subdirectories (CAUTION: this flag does not do what you
              think, avoid using it)

       -sfx[{name}]
              Create SFX archive

       -si    Read data from StdIn (eg:  tar  cf  -  directory  |  7zr  a  -si
              directory.tar.7z)

       -so    Write data to StdOut (eg: 7zr x -so directory.tar.7z | tar xf -)

       -slt   Sets technical mode for l (list) command

       -v{Size}[b|k|m|g]
              Create volumes

       -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]
              Update options

       -w[path]
              Set Working directory

       -x[r[-|0]]]{@listfile|!wildcard}
              Exclude filenames

       -y     Assume Yes on all queries

DIAGNOSTICS
       7-Zip returns the following exit codes:

              0      Normal (no errors or warnings detected)

              1      Warning (Non fatal error(s)).  For  example,  some  files
                     cannot  be  read  during  compressing.  So  they were not
                     compressed

              2      Fatal error

              7      Bad command line parameters

              8      Not enough memory for operation

              255    User stopped the process with control-C (or similar)

Backup and limitations
       DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
        - 7-zip does not store the owner/group of the file.

       On Linux/Unix, in order to backup directories you must use tar :
        -  to  backup  a  directory   :  tar  cf  -  directory  |  7zr  a  -si
       directory.tar.7z
        - to restore your backup : 7zr x -so directory.tar.7z | tar xf -

       If  you  want  to send files and directories (not the owner of file) to
       others Unix/MacOS/Windows users, you can use the 7-zip format.

         example : 7zr a directory.7z  directory

       Do not use "-r" because this flag does not do what you think.

       Do not use directory/* because of ".*" files (example  :  "directory/*"
       does not match "directory/.profile")

EXAMPLE 1
       7zr a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1
              adds all files from directory "dir1" to archive archive.7z using
              "ultra settings"

       -t7z   7z archive

       -m0=lzma
              lzma method

       -mx=9  level of compression = 9 (Ultra)

       -mfb=64
              number of fast bytes for LZMA = 64

       -md=32m
              dictionary size = 32 megabytes

       -ms=on solid archive = on

EXAMPLE 2
       7zr a -sfx archive.exe dir1
              add all files from directory "dir1" to SFX  archive  archive.exe
              (Remark : SFX archive MUST end with ".exe")

EXAMPLE 3
       7zr a -mhe=on -pmy_password archive.7z a_directory
              add  all  files  from  directory  "a_directory"  to  the archive
              "archive.7z" (with data and header archive encryption on)

SEE ALSO
       7z(1), 7za(1), bzip2(1), gzip(1), zip(1)

HTML Documentation
       /usr/share/doc/p7zip/DOCS/MANUAL/index.htm

AUTHOR
       Written for Debian by Mohammed Adnene Trojette.

Linux 压缩、解压文件的 4 种方式。tar、gzip、gunzip、zip、unzip、7z命令使用方法 tar 命令是 Linux 下常用的打包和压缩工具,用于将多个文件或目录打包成一个 tar 包,也可以将一个 tar 包解压缩到指定的目录。zip 是一种常用的压缩工具,可以将多个文件或目录打包成一个 zip 文件,也可以将一个 zip 文件解压缩到指定的目录。7z 是一种高压缩比的压缩工具,可以将多个文件或目录打包成一个 7z 文件,也可以将一个 7z 文件解压缩到指定的目录。tar 是一种常用的打包工具,可以将多个文件或目录打包成一个 tar 包,也可以将一个 tar 包解压缩到指定的目录。 阅读详情

相关推荐

7zr.exe

7zr

7zr.exe 命令解释

a:将文件添加到存档 b:基准 d:从存档中删除文件 e:从存档中提取文件(不使用目录名) h:计算文件的哈希值 i:显示有关支持格式的信息 l:列出档案内容 rn:重命名存档中的文件 t:测试档案的完整性 u:将文件更新到存档 x:提取具有完整路径的文件 –:停止开关和@listfile解析 -ai[r[-|0]{@listfile |!wildcard}:包含存档 -ax[r[-|0]{@listfile |!wildcard}:排除存档 -ao{a | s | t | u}:设置覆.........

飞丶宇 2323

7zr 一款体量极简的压缩/解压神器,编程好助手

7zr是一款体量极简的压缩/解压神器,可以轻松编程中调用其命令行进行压缩及解压,是数据备份的好工具 附:使用方法 7zr.exe 命令行压缩/解压完整用法(极简独立版7z工具,无图形界面) 一、基础语法 7zr <命令> [参数] 压缩包名 文件/目录路径 二、常用核心命令 1、压缩(a = add 添加文件到压缩包) ① 普通7z格式压缩(推荐压缩率最高) 7zr a test.7z D:\文件目录\* ② 压缩为zip格式 7zr a -tzip test.zip D:\文件目录\ ③ 设置压缩等级(1最快 / 9最高压缩) 7zr a -mx9 test.7z 待压缩文件.txt ④ 加密压缩(带密码) 7zr a -p123456 test.7z 文档.pdf 2、解压(x = 完整路径解压;e = 全部平铺解压,丢弃文件夹结构) 方式1:x 保留原有文件夹结构(日常首选) 7zr x test.7z -oD:\解压文件夹 -o后面紧跟输出目录,中间不能加空格 方式2:e 所有文件释放到同一文件夹(不推荐多层目录) 7zr e test.7z -oD:\解压位置 带密码解压 7zr x -p123456 test.7z -oD:\out 3、查看压缩包内容(l = list列表) 7zr l test.7z 4、删除压缩包内文件(d=delete) 7zr d test.7z 要删掉的文件名.docx 三、高频实用参数 参数 作用 -t7z 指定压缩格式为7z(默认) -tzip 指定压缩格式ZIP -mx1~mx9 压缩级别,mx1速度最快,mx9体积最小 -p密码 设置打开密码 -y 自动确认全部弹窗覆盖、确认提示 -bb1 显示详细执行日志

Linux中zr命令,Linux 7zr 命令 command not found 7zr 命令详解 7zr 命令未找到 7zr 命令安装 - CommandNotFound ⚡️ 坑否...

显示行号|选择喜欢的代码风格默认GitHubDuneLakeSidePlateauVibrantBlueEightiesTranquil7zr 命令是具有高压缩率的文件存档器。独立版本的 7z,仅支持 .7z 文件。7zr 命令安装:-bash/zsh: 7zr command not found#Debianapt-get install p7zip#Ubuntuapt-get install...

weixin_36164462的博客 2793

2025.03.14【读书笔记】|GWAS分析神器:BOLT-LMM工具介绍与快速安装

在生物信息学领域,全基因组关联分析(GWAS)已成为揭示遗传与疾病关系的强有力工具。BOLT-LMM作为一款专为大规模样本量设计的GWAS分析工具,将极大地提高研究人员的工作效率。大家好,今天我们来聊聊一个非常强大的生物信息学工具——BOLT-LMM。它是基于线性混合模型(LMM)的全基因组关联分析(GWAS)分析工具,通过快速的方差近似方法在计算效率上实现了显著的提升。BOLT-LMM的高效性能使其成为大规模样本GWAS分析的理想选择,它将进一步推动生物信息学和遗传学研究的发展。

1093

2025-03-21(DS复习): Databricks 的技术架构

Databricks 的技术架构以 ​为核心,构建了一套高度集成、可扩展且支持多云环境的统一分析平台。其架构设计注重存储与计算的深度融合,并通过丰富的服务层功能简化了数据工程、机器学习和数据科学的工作流。

baidu_24377669的博客 1428

使用7zr压缩文件夹

压缩文件夹

yuxing55555的博客 1397

Power BI常见问题篇1:无法打开文档

Power BI常见问题篇1:无法打开文档

weixin_48273257的博客 3304

【Linux笔记】压缩、解压文件的 4 种方式。tar、gzip、gunzip、zip、unzip、7z命令使用方法

在Linux系统中,有多种方式可以用于压缩和解压文件。

AliceNo的博客 1万+

量子城域网建设设备系列(三):网络管理系统(NMS)

本文对量子网络中的网络管理系统进行了初步的介绍。

量子领域相关话题 2012

STM32CubeMX、keil、simulink联合开发MCU教程

一、整体思路 利用Matlab的simulink搭建模型生成C代码,通过stm32cubemx生成工程,最后在KEIL或者IAR等工具里面编译生成代码下载至MCU中执行。 本文以流水灯建立模型和简单使用定时器为例进行演示。 二、开发环境 1、安装Matlab Matlab版本建议在2013B以上,本文使用Matlab 2016a。 2、安装STM32硬件支持包 下载地址(https://www.stmcu.org.cn/document/detail/index/id-216053) 安装完成后重启MAT

tzlaa的博客 7734

7z powershell_使用PowerShell Z快捷方式在目录周围花费更少的CD时间

7z powershellEveryone has a trick for moving around their computer faster. It might be a favorite shell, a series of aliases or shortcuts. I like using popd and pushd to quickly go deep into a directo...

293

lammps剪切模拟的三种实现方法

本文介绍了LAMMPS分子动力学模拟中三种剪切方法:fix deform全局盒子剪切、速度边界剪切和外力加载剪切。fix deform通过改变盒子形状实现均匀剪切,适合宏观力学参数计算;速度边界剪切通过固定边界原子施加速度模拟非均匀剪切,适合界面摩擦研究;外力加载剪切则通过施加恒定力研究材料屈服行为。文章详细说明了每种方法的适用场景、核心原理和关键命令,并强调应根据具体研究目标选择合适方法。这些方法为金属、聚合物等材料的剪切模拟提供了实用解决方案,可直接套用文中命令进行建模计算。

lammps_jiayou的博客 64

linux下安装7z命令及7z命令的使用

本文主要介绍了在linux下安装7z命令的方法,同时介绍了7z命令的使用。7z压缩格式拥有众多优点,具有极高的压缩比率,如果你还不了解,请看文章:7z格式、LZMA压缩算法和7-Zip详细介绍。 reille使用的linux发行版是ubuntu,同时在Redhat上业已验证,可正常使用。 1. linux安装7z命令 linux上安装7z命令有两种方式:在线安装和安装包安装,下面分...

weixin_30609287的博客 2323

基于Simulink的风电系统背靠背变流器解耦控制仿真

本文完成了基于 Simulink 的风电背靠背变流器解耦控制仿真,实现了:✅掌握 dq 解耦控制的数学本质✅构建 MSC + GSC 完整控制链✅验证其在动态、扰动下的卓越性能✅达成高解耦度、低 THD、稳母线三大目标。

xiaoheshang_123的博客 79

Harness Engineering:让Coding Agent真正落地生产

本文将带你系统性地了解如何让Coding Agent真正落地生产,核心是依托(全球领先的持续交付、云成本管理、 feature flagging、安全治理一体化平台),结合企业级AIDD(AI-Driven Development)的工程化实践,构建一套可信赖、可观测、可扩展、可治理的Coding Agent落地体系。核心概念与理论基础:什么是Coding Agent?它和普通的AI代码补全工具(比如GitHub Copilot)有什么区别?什么是Harness Engineering?

移动开发前沿的博客 455

7z 指定解压某些文件

在使用7z命令来解压7z压缩文件时,如果你只想解压文件中的特定文件或文件夹,可以通过-i(或--include)选项来指定要解压的文件。

zengliguang的专栏 1229

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

如何解压7Z压缩文件?实用教程来了

收到.7z别发愁:如何解压7Z文件全攻略

2201_75894279的博客 3359

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

上一篇: Pluck a nose hair(程序员,请不要拔鼻毛)
下一篇: mysql之 存在则修改,不存在则插入的sql(inert if not exist,else update)语法
hellochenlian
博客等级 码龄17年 629粉丝 295原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

打赏作者

hellochenlian

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值