Author Options:

Batch file zip Answered

I need a batch file that will zip up text file with a password that resides on a network drive. Can some one help me with this?


After a few hours of trying I still didn't get very far. Can someone post some code that would use 7zip that in a Batch file would zip up a file called testzip? C:\ziptest and apply a password of jj2154 to it. Thanks!!

. Try:
  7z a -tzip C:\ziptest.zip C:\WINDOWS\Fonts\* -r -pPassword
. Change "C:\WINDOWS\Fonts\*" to point to the directory you want to ZIP and Password to whatever you want.
. 7z - invokes the program
. a - add files
. -tzip - use ZIP format
. C:\testzip.zip - name of destination file
. C:\WINDOWS\Fonts\* - files to compress (your fonts, in this case)
. -r - recurse subdirectories (not needed if there are no subdirs or you don't want to compress them)
. -pPassword - sets password to "Password"

. PS: You may need to prepend "C:\Program Files\7-Zip\" to that command, if Windows complains that it can't find the program.

. OK. This works on my machine:
   "C:\Program Files\7-Zip\7z" a -tzip C:\ziptest.zip C:\WINDOWS\Fonts\* -r -pPassword

. Depends on which program you are using to do the ZIPping. Refer to the documentation for your program, ie, RTFM.

The only zip program that I have on my pc is 7zip. But if you know of one that is easer to use I get it.

. Start menu:All Programs:7-Zip:7-Zip Help:Command Line Version