简体   繁体   English

使用7zip提取存档文件,文件夹中有空格

[英]Extract archive file using 7zip with space(s) in the folder

I want to extract all the 7z files in the folder and subfolder using the batch below. 我想使用下面的批处理提取文件夹和子文件夹中的所有7z文件。

for /F %%I IN ('dir /b /s *.7z ') DO (
    "C:\Program Files\7-Zip\7zG.exe" x -o"%%~dpI" "%%I"
)

But if the folder path with a space between, the batch is not working. 但是,如果文件夹路径之间有空格,则该批处理将无法正常工作。

Example: 例:

X |-- a |-- 1.7z |-- bc |-- 2.7z

The 2.7z in the folder bc will not be extracted. 不会提取文件夹bc2.7z

Can I know how to ignore the space? 我可以知道如何忽略空间吗?

for /F "DELIMS=" %%I IN ('dir /b /s *.7z ') DO (

Turns off delimiters. 关闭定界符。 By default, space is a delimiter, so %%I is set to (the string up to the first delimiter) 默认情况下,空格是定界符,因此%%I被设置为(第一个定界符之前的字符串)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM