Windows batch script to unzip files in a directory
Ansgar's response above was pretty much perfect for me but I also wanted to delete archives afterwards if extraction was successful. I found this and incorporated it into the above to give:
for /R "Destination_Folder" %%I in ("*.zip") do (
"%ProgramFiles%\7-Zip\7z.exe" x -y -aos -o"%%~dpI" "%%~fI"
"if errorlevel 1 goto :error"
del "%%~fI"
":error"
)
Try this:
for /R "C:\root\folder" %%I in ("*.zip") do (
"%ProgramFiles(x86)%\7-Zip\7z.exe" x -y -o"%%~dpI" "%%~fI"
)
or (if you want to extract the files into a folder named after the Zip-file):
for /R "C:\root\folder" %%I in ("*.zip") do (
"%ProgramFiles(x86)%\7-Zip\7z.exe" x -y -o"%%~dpnI" "%%~fI"
)