Search code examples
batch-filemakefilecabmakecab

batch file to makecab file with password and extract it using password


i want batch file to make cab file using makecab with password and extract it using the same password (i want the two codes alone)

first code:

makecab /add %USERPROFILE%\DESKTOP\M.TXT M.zip /P:12345

second code:

makecab /extract %USERPROFILE%\DESKTOP\M.zip /P:12345

Solution

  • MAKECAB does not support password protection and despite one of it's compression algorithms is MSZIP it is not exactly a zip file

    Makecab user guide

    My suggestion is to use 7za (check comments for more info).

    7za a  -p12345 m.zip m.txt
    

    extract

    7za a  -p12345 m.zip m.txt
    

    7za can be downloaded from here