in Advanced 

Question preview

HomeQuestion preview:
Log in

Zip or unzip files in Windows XP from command line

How can I zip or unzip files in Windows XP from command line? I want to use the default XP archivator?
Do you know someone who could answer? Ask him for help
Answers: 3
Sort by: date rating
image kuku
13:49/15.05.2008
1.3 from possible 5 with 25 votes
Use the COMPACT command. Take a look at its reference:

http://technet.microsoft.com/en-us/library/bb490884.aspx
Vote:
image bobpaul
19:13/15.07.2011
4 from possible 5 with 1 votes
Compact is wrong. That's for enabling and disabling NTFS file compression of a file on disk, not for creating and extracting *.zip files.

The easiest ways are using java:

java xf file.zip

or some other third party tool (7zip, pkzip, info-zip, etc) that has a decent CLI tool.

If you must use the built in windows zip tool, you can do it using this Visual Basic like this:
http://stackoverflow.com/questions/2...ip-file-with-vbscript

Because windows doesn't actually clean up the temp folder automatically, and because the script referenced can't handle temp folder names greater than 99, you'll only be able to run it 99 times before it fails. So you'll want to modify the script to delete it's temp folder after it extracts.

(ProTip: if you want to read the Expert's Exchange linked in the Stack Overflow, paste the URL into Google and click from there, then scroll WAY down to the bottom.)
Vote:
image xpert
13:45/27.07.2011
-
I personally prefer to use 7zip command line tool. First you need to install 7zip from http://www.7-zip.org/ . Then you can make bat file like this one:

"c:\Program Files\7-Zip\7z.exe" a -tzip docs.zip -ir!docs\*.* -xr!.svn


The above command will exclude all svn files recursively (because I have this folder under source control, and I don't want then in the archive) and will make docs.zip. This ".bat" file must be reside at the same with the folder "docs".
Vote:
Please vote! Your opinion matters!
If you haven't found what you've looking for, post a question
Ask question
| Home | Hall of fame | Registration | Log in | Terms of service | Privacy policy | Help | Contacts | RSS |