Microsoft KB Archive/323425

= HOW TO: Use the COMPACT Command to Compress and Uncompress Files and Folders in Windows Server 2003 =

PSS ID Number: 323425

Article Last Modified on 4/5/2004

-

The information in this article applies to:


 * Microsoft Windows Server 2003, Datacenter Edition
 * Microsoft Windows Server 2003, Enterprise Edition
 * Microsoft Windows Server 2003, Standard Edition
 * Microsoft Windows Server 2003, Web Edition
 * Microsoft Windows Server 2003, 64-Bit Datacenter Edition
 * Microsoft Windows Server 2003, 64-Bit Enterprise Edition
 * Microsoft Windows Small Business Server 2003, Standard Edition
 * Microsoft Windows Small Business Server 2003, Premium Edition

-



This article was previously published under Q323425



For a Microsoft Windows 2000 version of this article, see 314958.

IN THIS TASK

 * SUMMARY
 * ** How to Use the Compact Command to Compress and Uncompress Files and Folders
 * *** Examples
 * REFERENCES



SUMMARY
This step-by-step article describes how to use the compact command to compress and uncompress files and folders in Windows Server 2003.

back to the top

How to Use the Compact Command to Compress and Uncompress Files and Folders
Compact.exe is the command-line version of the file and folder compression feature in Windows Server 2003. Use the compact command to compress, to uncompress, or to display the compression state of files and folders on volumes formatted with the NTFS file system.

Use the following syntax for the compact command:

compact /c /u /s: /a /q /i /f  ...

You can use the following parameters with the compact command:
 * no parameter: When you do not specify any parameters, the compression state of the current folder is displayed.
 * /c: This parameter compresses the specified file or folder.
 * /u: This parameter uncompresses the specified file or folder.
 * /s: : This parameter specifies that the requested compress or uncompress action is applied to all subfolders of the specified folder, or to the current folder if you do not specify one.
 * /a: This parameter displays files with the hidden or with system attribute.
 * /q: This parameter reports only the most important information.
 * /i: This parameter ignores any errors that may occur.
 * /f: This parameter forces the compression or the uncompression of a specified folder file or folder.

If the hard disk fails during a compression or uncompression operation, the file or folder is marked as Compressed or Uncompressed, even if the operation did not complete. In this situation, use the /f parameter to force the completion of the compress or the uncompress operation.
 *  : This parameter specifies a pattern, a file, or a folder. You can use multiple file names, the asterisk (*) wildcard character, and the question mark (?) wildcard character with this parameter.

back to the top

Examples:
 To compress the current folder, subfolders in the current folder, and all files that are in the current folder and subfolders, type the following command line from the command prompt, and then press ENTER:

compact /c /s

 To uncompress the current folder, subfolders in the current folder, and all files that are in the current folder and subfolders, type the following command line from the command prompt, and then press ENTER:

compact /u /s

 To compress all .bmp files that are in the Graphics folder and its subfolders, but not change the compression state of these folders, type the following command line from the command prompt, and then press ENTER:

compact /c /s:\graphics *.bmp

 To uncompress the C:\Temp folder, but not change the compression state of any files that are in that folder, type the following command line from the command prompt, and then press ENTER:

compact /u c:\temp

 To force the complete compression of the MyPic.bmp file, which was partially compressed during a hard disk failure, type the following command line from the command prompt, and then press ENTER:

compact /c /f mypic.bmp



back to the top

