简体   繁体   中英

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.

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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