This segment of my review of the tools in the Microsoft Windows Server 2003 Resource Kit dives into the Compress.exe and Expand.exe utilities.
If you need to make a compressed copy of a file via a script or command line, then these utilities may help.
Per Microsoft:
The copy portion is the key to this compress utility. Most simple compression tools will allow you to compress the original file. Compress actually leaves the original target uncompressed, and instead makes a copy of that original and compresses it. It's important to note that this utility does not compress many files into a single file, such as a CAB file. If you choose to compress all the files in a directory (using a wildcard), it creates a single compressed file for each file in the source directory.
After compressing these files, you then use the Expand.exe utility to uncompress the data. You can also use Expand.exe to extract files from a cabinet (.cab).
Requirements:
Installation:
General use:
Compress Source Destination
Expand Source Destination
Issues:
Microsoft's help file oddly states, "Do not use Compress.exe (compress) to compress files or folders on the NTFS file system formatted files or folders. To compress or decompress NTFS-formatted files or folders, use the Compact command-line tool or set the Compressed attribute of the file or folder in Windows Explorer." However, I don't quite understand this warning. True, the
To continue reading for free, register below or login
To read more you must become a member of SearchWindowsServer.com
');
// -->

compress utility is old, but it seems to work just fine on an NTFS formatted volume, where the files and folders reside. I do know that you cannot use the built-in NTFS file properties dialog box to uncompress a file that has been compressed using this utility. Perhaps Microsoft wants you to make sure to use the compact tool instead so you can use the NTFS file properties windows to uncompress the file.
Windows XP appears to have a bug in that it cannot pass the source path. In other words, if you want to compress a file in the c:\folder1 directory to another directory called folder2, you cannot run the following command: compress c:\folder1\test.txt c:\folder2. If you do, you will receive an ERROR: Unable to open C:\folder1\test.txt message. The only way around this is to navigate to the directory that contains the source file, and then run the compress command. So, using the example above: c:\folder1> compress test.txt c:\folder2.
The Microsoft Windows Server 2003 Resource Kit tools are a set of tools to help administrators streamline management tasks, such as troubleshooting operating system issues, managing Active Directory®, configuring networking and security features, and automating application deployment.
About the author: Tim Fenner (MCSE, MCSA: Messaging, Network+ and A+) is a senior systems administrator who oversees a Microsoft Windows, Exchange and Office environment. He is also an independent consultant who specializes in the design, implementation and management of Windows networks.