0

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
npocmaka
  • 55,367
  • 18
  • 148
  • 187
user3752270
  • 99
  • 2
  • 10

1 Answers1

0

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

npocmaka
  • 55,367
  • 18
  • 148
  • 187
  • this program include in windows ?? if not i want program include in windows – user3752270 Aug 31 '14 at 21:06
  • @user3752270 `MAKECAB` is included in every windows distribution out there.If using a third party tool is not a problem for you - the most common choice is `7za` part of `7zip` -> http://www.7-zip.org/download.html – npocmaka Aug 31 '14 at 21:12
  • not problem if it not cab the important thing is when i compress it will include password (not problem if there is codes on vbs) – user3752270 Aug 31 '14 at 21:15
  • @user3752270 - vbscript/jscript/wsh support zipping and unzipping through `"Shell.Application"` (http://superuser.com/questions/110991/can-you-zip-a-file-from-the-command-prompt-using-only-windows-built-in-capabili) (which is a scriptable part of windows explorer) but still it does not support password sets.It's possible to do this through `.net` which will require powershell or selfcompiled jscript program , but it will take me time.Still I think `7za` is the easiest way - check the reference - http://www.dotnetperls.com/7-zip-examples – npocmaka Aug 31 '14 at 21:29
  • @user3752270 - I'e updated my answer with `7za` examples.If you wish an powershell/.net solution you'll have to wait (still not sure if I'll have the time..) – npocmaka Aug 31 '14 at 21:41