标题类似于说明了一切.我不知道怎么做,另 一篇文章在CMD行中使用7zip解压缩文件夹中的所有文件
我没有一致地解释一下.有人可以用一种简单的方法解压缩特定文件夹中的所有.zip文件吗?
Gab*_*bor 35
这将解压缩当前文件夹中的所有zip文件(进入同一文件夹),假设您已将7zip安装到C:\Program Files\7-Zip位置.
如果您已将7zip文件夹添加到路径中,则只需输入7z而不是完整路径
"C:\Program Files\7-Zip\7z.exe" e *.zip
Run Code Online (Sandbox Code Playgroud)
只是为了加伯的答案。我的默认安装文件夹是,C:\Program Files (x86)\7-Zip所以我要去那里。这是下载7zip的链接。
我想将目录中的每个zip文件解压缩到多个文件夹中。但是e,上一个答案中的将导出目录中的所有内容。
这是针对“正常”解压缩的,每个解压缩的zip文件都会创建一个文件夹:
"C:\Program Files (x86)\7-Zip\7z.exe" x *.zip
Run Code Online (Sandbox Code Playgroud)
要全面了解7z.exe的用途,请使用--help:
"C:\Program Files (x86)\7-Zip\7z.exe" --help
Run Code Online (Sandbox Code Playgroud)
这是它的输出:
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
Run Code Online (Sandbox Code Playgroud)
我不确定OP的意图,但我认为为每个.zip文件都有一个子文件夹是个好主意,这样同名的文件就不会被覆盖。(就像使用鼠标右键拖放多个 .zip 文件并从本地菜单中选择 7-Zip > 提取文件... 一样。)
为此,我在命令行中使用它:
for /f "usebackq delims=" %f in ( `dir /b /s *.zip` ) do 7z x "%f" -o"%~pf%~nf"
Run Code Online (Sandbox Code Playgroud)
如果您的环境变量中没有7-Zip的程序文件夹PATH,则需要写入其完整路径。在 x86 Windows 或带有 x64 7-Zip 的 x64 Windows 上:
for /f "usebackq delims=" %f in ( `dir /b /s *.zip` ) do "C:\Program Files\7-Zip\7z.exe" x "%f" -o"%~pf%~nf"
Run Code Online (Sandbox Code Playgroud)
在使用 x86 7-Zip 的 x64 Windows 上:
for /f "usebackq delims=" %f in ( `dir /b /s *.zip` ) do "C:\Program Files (x86)\7-Zip\7z.exe" x "%f" -o"%~pf%~nf"
Run Code Online (Sandbox Code Playgroud)
注意: cmd 替换%~pf为变量 的路径(实际上是目录名,包括末尾的反斜杠)%f和%~nf文件名(不带文件扩展名)。
| 归档时间: |
|
| 查看次数: |
69894 次 |
| 最近记录: |