Help - Search - Members - Calendar
Full Version: ZIP command line options in XP
Neowin Forums > Windows Support > Windows NT4/2000/XP Client
neojoker
Is there any way, by default, to use command line options to add files and folders to a zip file in Windows XP (meaning, using XP's built in Compressed Files feature instead of installing WinZIP, etc.)? Thanks.
JRosenfeld
Command line guide for XP:

http://www.microsoft.com/resources/documen...s.mspx?mfr=true

look at compact.
neojoker
That looks like the actual NTFS compression. I'm wanting to use Zip files. Or maybe I just read it incorrectly. smile.gif

Thanks.
Digix
DOS's pkzip B) too bad it lives on in windows 98 and not in xp
JRosenfeld
I understood you to say you wanted to use the native XP method for compressed files. As far as I know, XP treats a.zip file like a compressed folder.

I happen to have Winzip installed, and usually use that to open a .zip file. However if I right click on a .zip file in Windows Exploer and click Explore, it opens like a subfolder in Windows Explorer.

So I think the compact command should work.

Oops, just tried, it does not work to add a file to a .zip file. It does work to add and compress a file to a compressed folder.
brand
now i'm severly interested in this.

humm...

opening the compressed folder view (explorer):
rundll32.exe zipfldr.dll,RouteTheCall [Zipfile].zip


I'm gonna spend some time looking for of this up to see if there are other calls available.
John
Quote - (JRosenfeld @ Aug 24 2006, 09:09) [snapback]587815345[/snapback]

Command line guide for XP:

http://www.microsoft.com/resources/documen...s.mspx?mfr=true

look at compact.

The compact command configures NTFS compression on files and folders, not .zip files, which XP calles "Compressed Folders" (a bit misleading)...
brand
alright... after some long investigating i figured out that there is no way to run this via command line, even rundlling the dll file.

Any programming examples i found (I was hoping to write up a quick vbscript to use) simulate a drop-target function, and call the CLSID of the send-to folder shortcut thing.

Oh microsoft, you've failed us again. I mean, it's another stupid little thing that it would take a single microsoft programmer a day to bang out a DLL, or even an gui executable, or command line... but noooooo they wouldn't've wanted to do that.

maybe for vista. PowerShell?
MazX_Napalm
7 Zip has command line functionality.

And its free.
Bananashake
Yeah, but he doesn't want to use an external program and want the internal Zip tool to do that.
njlouch
I use Winzip with the command line addon. I understand that it's an external program, but hey - just a suggestion.
BudMan
Um, who said xp did not support compressed folders from the command line?

C:\>compress /?

Syntax:

COMPRESS [-R] [-D] [-S] [ -Z | -ZX ] Source Destination
COMPRESS -R [-D] [-S] [ -Z | -ZX ] Source [Destination]

Description:
Compresses one or more files.

Parameter List:
-R Rename compressed files.

-D Update compressed files only if out of date.

-S Suppress copyright information.

-ZX LZX compression. This is default compression.

-Z MS-ZIP compression.

Source Source file specification. Wildcards may be
used.

Destination Destination file | path specification.
Destination may be a directory. If Source is
multiple files and -r is not specified,
Destination must be a directory.

Examples:
COMPRESS temp.txt compressed.txt
COMPRESS -R *.*
COMPRESS -R *.exe *.dll compressed_dir

edit: grab the 2k3 resource kit and it does wink.gif
http://www.microsoft.com/downloads/details...;displaylang=en

But it might be easier -- and clearly more features to just use a FREE tool like 7z
C:\>7z

7-Zip 4.42 Copyright © 1999-2006 Igor Pavlov 2006-05-14

Usage: 7z <command> [<switches>...] <archive_name> [<file_names>...]
[<@listfiles...>]

<Commands>
a: Add files to archive
d: Delete files from archive
e: Extract files from archive (without using directory names)
l: List contents of archive
t: Test integrity of archive
u: Update files to archive
x: eXtract files with full paths
<Switches>
-ai[r[-|0]]{@listfile|!wildcard}: Include archives
-ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
-bd: Disable percentage indicator
-i[r[-|0]]{@listfile|!wildcard}: Include filenames
-m{Parameters}: set compression Method
-o{Directory}: set Output directory
-p{Password}: set Password
-r[-|0]: Recurse subdirectories
-scs{UTF-8 | WIN | DOS}: set charset for list files
-sfx[{name}]: Create SFX archive
-si[{name}]: read data from stdin
-slt: show technical information for l (List) command
-so: write data to stdout
-t{Type}: Set type of archive
-v{Size}[b|k|m|g]: Create volumes
-u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
-w[{path}]: assign Work directory. Empty path means a temporary directory
-x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
-y: assume Yes on all queries
njlouch
Where is this compress exe? I run cmd type compress with the needed params - not found. Is this part of XP? Can't find it - searched c:
BudMan
Like I said you need to download the resource kit for 2k3.. which is FREE. But you know upon further playing with it and its not very good. I would highly suggest the user just bite the bullet and use a external program.. ie 7zip is FREE for all uses personal and work, etc.

njlouch
Thanks, sorry missed the resource kit. My bad!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.