File Systems

Compress is a command-line tool that can be used to create compressed copies of one or more files, similar to popular third-party file compression tools. If the destination listed on the command line does not include a new file name for the compressed file, the file's original name is used (a new name is required to save the compressed file in the same folder as the original).

You cannot work with a file that has been compressed by this tool until you have uncompressed it with the tool Expand. The compressed file appears to be corrupted if you attempt to use it. Typically, files compressed with this tool are named with the last letter of the file name extension replaced with an underscore character (_) to clearly identify the file as compressed. Many of the files on the Windows 2000 operating system CD are compressed and use this naming scheme to indicate to the user that they need to be uncompressed before they can be used. The syntax of Compress is:

compress [–r] [–d] [-z] sourcedestination

Table 17.15 describes the switches available with Compress.

Table 17.15 Compress Switches

Switch

Description

–r

Renames compressed files.

–d

Updates compressed files only if out-of-date.

-z

Types of compression used:
-z — MS-ZIP compression
-zx — LZX compression
-zq[ n ] — Quantum compression and optional level, ranging from 1-7
(default is 4)

source

Specifies the source file. The asterisk ( * ) and question mark ( ? ) wildcard characters can be used.

destination

Specifies the destination file or path. The destination can be a folder. If source specifies multiple files and the –r switch is not specified, then destination must be a folder.

/?

Displays user help.

note-icon

Note

Do not use Compress to compress files or folders on NTFS volumes. Instead, compress NTFS files and folders by using Compact or by setting or clearing the Compressed attribute in Windows Explorer.

Compress is a Windows 2000 Resource Kit tool. Install this tool from the Windows 2000 Resource Kit companion CD.