COMPACT

Shows and changes file compression on NTFS partitions.

COMPACT [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [/EXE[:algorithm]] [/COMPACTOS[:option] [/WINDIR:dir]] [filename [...] ]

Where:

  • /C - Compresses the specified files. Directories will be marked to compress files added later unless the /EXE option is specified.
  • /U - Unpacks the specified files. Directories will be marked to not compress files added later. If /EXE is specified, only files compressed as executables will be unpacked. If /EXE is omitted, only NTFS compressed files will be unpacked.
  • /S[:dir] - Performs the operation on files in the specified directory and all its subdirectories (default: current directory).
  • /A - Shows files with hidden or system attributes (default: omitted).
  • /I - Continues the operation even after errors (default: stop on error).
  • /F - Forces compression even on already compressed files (default: ignored).
  • /Q - Reports only the essential information.
  • filename - Specify a search criterion, file, or directory.
  • /EXE[:algorithm] - Uses optimized compression for frequently read and unmodified executable files. Supported algorithms are: XPRESS4K (fastest, default), XPRESS8K, XPRESS16K, and LZX (highest compression).
  • /COMPACTOS[:option] - Sets or requests the system compression state. Instead of option specify:
    • QUERY - Queries the system compression state.
    • ALWAYS - Compresses all operating system binaries and sets the system state to compact, which will be maintained until changed by the administrator.
    • NEVER - Unpacks all operating system binaries and sets the system state to non-compact, which will be maintained until changed by the administrator.
  • /WINDIR:dir - Used with /COMPACTOS:QUERY, specifies the directory where Windows is installed.

Without any parameters, displays the compression status of the current directory and the files it contains.

Examples:

1. Compress the file C:\agh.h, reporting only the essential information:

compact /c /q "C:\agh.h"

 

2. Unpack the file C:\agh.h continuing operation even after errors:

compact /u /i "C:\agh.h"

Comments