简体   繁体   中英

Extract multiple zip files recursively using 7z script file

I have a folder which has multiple zip files in multiple folders and I would like to extract it all by using a script file

I went over the answer from stack overflow from here https://superuser.com/questions/248287/extract-recursively-using-7-zip

FOR /F "usebackq" %a in (`DIR /s /b *.zip`) do 7z.exe e %a

and it is extracting well, the problem is that it is extracting all files to the root folder, and I want every zip to be extracted in it's original folder next to the .zip file

meaning next to \\folder\\file.zip I will have

\folder\file.zip
\folder\content_of_zip.txt

7z includes a switch to indicate where to extract the files. We can use it to indicate the drive and path of the file being referenced by the for command.

for /r %a in (*.zip) do 7z.exe e "%~a" -o"%~dpa"

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