Search code examples
batch-filepassword-protection7zip

How to add password to my zip batch?


for /d %%X in (*) do (for /d %%a in (%%X) do ( "C:\Program Files\7-Zip\7z.exe" a -tzip "%%X.zip" ".\%%a\" ))

This is what I use right now I want to add password to it please help


Solution

  • If you type

    7z
    

    It will display all the switches. The one you are looking for is -p

    for /d %%X in (*) do (for /d %%a in (%%X) do ( "C:\Program Files\7-Zip\7z.exe" a -ppassword -tzip "%%X.zip" ".\%%a\" ))