0
votes

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 |-- b c |-- 2.7z

The 2.7z in the folder b c will not be extracted.

Can I know how to ignore the space?

1

1 Answers

1
votes
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)