在解压缩CMD线使用7zip的文件夹中的所有文件 [英] Unzip all files in a folder using 7zip in CMD line

查看:377
本文介绍了在解压缩CMD线使用7zip的文件夹中的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这些线路中提取一个文件夹中的所有JAR文件,目标可以是同一台:

i'm using these lines to extract all JAR files in a folder, destination can be the same one :

<b>set SEVENZIP_EXE=C:\Program Files\7-Zip\<br>
set INPUT_FOLDER=D:\jar

for /f "tokens=1-2 delims=. " %%a in ('dir *.jar /a-d/b') do "%SEVENZIP_EXE%" x -aoa -o"%INPUT_FOLDER%" %%a.%%b

但是,所有我得到的是:%%一个是意外在这个时候。

But all what i got is : %%a was unexpected at this time. !!

什么建议吗?结果
谢谢

any suggestion ?
Thanks

推荐答案

您是在命令提示符下运行它,而不是在一个批处理文件。如果你是一个提示,你应该只使用单一%:

You're running it in a command prompt, not on a batch file. If you're on a prompt, you should only use a single %:

set INPUT_FOLDER=D:\jar

for /f "tokens=1-2 delims=. " %a in ('dir *.jar /a-d/b') do "%SEVENZIP_EXE%" x -aoa -o"%INPUT_FOLDER%" %a.%b

我也注意到,您没有设置路径的7-Zip的可执行正确:

I also noticed that you didn't set the path to 7-zip's executable properly:

set SEVENZIP_EXE=C:\Program Files\7-Zip\7z.exe

如果不工作,也许尝试运行它作为一个批处理文件

If it doesn't work perhaps try running it as a batch file

@echo off

set SEVENZIP_EXE=C:\Program Files\7-Zip\7z.exe
set INPUT_FOLDER=D:\jar

for /f "tokens=1-2 delims=. " %%a in ('dir *.jar /a-d/b') do "%SEVENZIP_EXE%" x -aoa -o"%INPUT_FOLDER%" %%a.%%b

这篇关于在解压缩CMD线使用7zip的文件夹中的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆