How to Unzip PASSWORD PROTECTED file using Batch Script via 7Zip?
14,512
Solved it!
To make it easy to see where the password goes, I've made it a variable.
@echo off
set yourZipPassword=[ENTER YOUR PASSWORD HERE]
set yourFolderPath=[ENTER YOUR PATH HERE]
for /R "%yourFolderPath%" %%I in ("*.zip") do (
"C:\Program Files\7-Zip\7z.exe" x -p%yourZipPassword% -y -o"%%~dpI" "%%~fI"
)
Author by
TMY
Updated on June 05, 2022Comments
-
TMY almost 2 years
I have the following batch code that currently unzips files using 7Zip:
for /R "%zipFilePath%" %%I in ("*.zip") do ( "C:\Program Files\7-Zip\7z.exe" x -y -o"%%~dpI" "%%~fI" )
However, I now need to unzip password protected files and I'm not sure where to pass a variable password into the current code.
I think based on www.7Zip.org, I'd have to do something:
-pPASSWORD
where PASSWORD is the password. But I've tried a few different locations in my code for the -p, but can't get it to execute properly.
Any help would be greatly appreciated!