Script for Extracting Files with Passwords

For this occasion we’ll have a batch script for extracting files protected with a password. The code:

echo off
setlocal EnableDelayedExpansion

set OriginSrc="C:\Users\Michael\My Documents\Galleries\Birthdays\20170415-Images.7z"
set Destination="Images"
echo %DestDir%

set Password=mypass

rmdir %Destination%
"C:\Program Files\7-Zip\7z.exe" e "%OriginSrc%" -y -p%Password% -o"%Destination%


If the passed password was the one we’ll see something like this:


Otherwise, will result in an error and you’ll need to change the password.