How To Use Compact.Exe To Free Up Disc Space

WHAT IS COMPACT.EXE

compact.exe displays or alters the compression of files on NTFS partitions. compact [command-line-options] [ filename-1[, filename-2 …] compact can be invoked without command line parameters in which case it simply reports the compression state of the current directory and any files it contains.

compact.exe is an executable file that is part of Windows 10 Operating System developed by Microsoft Corporation. The Windows version of the software: 10.0.10240.16384 is usually about 18432 bytes in size, but the version you have may differ.

compact.exe

compact.exe displays or alters the compression of files on NTFS partitions.

compact [command-line-options] [ filename-1[, filename-2 …]

compact can be invoked without command line parameters in which case it simply reports the compression state of the current directory and any files it contains.Wildcards are supported.Multiple filenames and wildcards can be specified.Note that hidden and system files are not displayed by default. /a is needed to show them as well.

Command line options

/cCompresses the specified files. Directories will be marked so that files added afterward will be compressed unless /exe is specified.
/uUncompresses the specified files. Directories will be marked so that files added afterward will not be compressed. If /exe is specified, only files compressed as executables will be uncompressed; if this is omitted, only NTFS compressed files will be uncompressed.
/s:dirPerforms the specified operation on files in the given directory and all subdirectories. If omitted, it defaults to the current directory.
/aDisplays files with the hidden or system attributes. These files are omitted by default.
/iContinues performing the specified operation even after errors have occurred. By default, compact stops when an error is encountered.
/fForces the compress operation on all specified files, even those which are already compressed. Already-compressed files are skipped by default.
/qReports only the most essential information.
/exe:algorithmSpecify compression method.
/compactOsSet or query the system’s compression state. Supported options are: query: Query the system’s Compact state; always: Compress all OS binaries and set the system state to compact which remains unless administrator changes it; never: Uncompress all OS binaries and set the system state to non-compact which remains unless administrator changes it.
/winDirUsed with /CompactOs:query when querying the offline OS to secifies the directory where Windows is installed.

Supported algorithms

compact.exe supports the following algorithms for the /exe paramter:

  • XPRESS4K (fastest and also default)
  • XPRESS8K
  • XPRESS16K
  • LZX (most compact)

Example

cd       %temp%
mkdir    test-dir-for-compact
dir     /s /b c:\windows\System32 > test-dir-for-compact\files-system32.txt
compact /c /s:test-dir-for-compact /exe:LZX 

Is compact.exe safe, or is it a virus or malware?

The first thing that will help you determine if a particular file is a legitimate Windows process or a virus, is the location of the executable itself. With compact.exe for example, it's path will probably be something like C:\Program Files\Microsoft Corporation\Windows 10 Operating System\compact.exe

To determine it's path, open Task Manager, go to View -> Select Columns and select "Image Path Name" to add a location column to your Task Manager. If you find a suspicious directory here, it may be a good idea to investigate this process further.

Another tool that can sometimes help you detect bad processes is Microsoft's Process Explorer. Start the program (it does not require installation) and activate "Check Legends" under Options. Now go to View -> Select Columns and add "Verified Signer" as one of the columns.

If the "Verified Signer" status of a process is listed as "Unable to Verify", you should take a moment look at the process. Not all good Windows processes have a Verified Signature label, but neither do any of the bad ones.

The most important facts about compact.exe:

Name: compact.exe
Software: Windows 10 Operating System
Publisher: Microsoft Corporation
Expected Location: C:\Program Files\Microsoft Corporation\Windows 10 Operating System\ subfolder
Expected Full Path: C:\Program Files\Microsoft Corporation\Windows 10 Operating System\compact.exe
SHA1: D1F05969A0EEA85F2D96CB3B235CE4838D7C0039
SHA256:
MD5: d0b42a077320d2ab2d2a80bcbcae02cb
Known to be up to 18432 bytes in size on most Windows;
If you had any difficulties with this executable, you should determine if it's trustworthy before deleting compact.exe. To do this, find this process in Task Manager.

How to use compact.exe to free up disk space on Windows

Microsoft introduced new options for the command line tool compact.exe in the Windows 10 operating system. It allows users to compress folders on the system using new algorithms to free up disk space.

Unlike many other compression solutions, compact promises to have little impact on performance when the files need to be loaded by the system. Files are compressed without changing the file extension or location. Decompression happens during runtime, and most modern systems should not break a sweat doing so. The tool is included in Windows 11 as well.

Compact.exe compresses files and folders on Windows without changing filenames or making other modifications to the files. Depending on the type of files, compression may save Gigabytes of disk space or very little. Files that are compressed already, e.g., JPG image files, will show little gains when compress is run on them. Uncompressed files on the other hand may show large gains. You can check out this GitHub page, which lists hundreds of games and programs, and the savings when using compress.exe on them.

A few applications and games may react badly to compression. If that is the case, uncompressing will resolve the issue.

ADVERTISEMENT
Tip: if you prefer a graphical user interface, check out CompactGUI. Windows includes an option to compress the entire drive. Right-click on any drive in explorer and select Properties to open the option. You find "Compress this drive to save disk space" under General in the properties window.

Using compact.exe on Windows
compact output

You may run the program from any command prompt window. Open a new command prompt window, e.g., by using Windows-R to open the run box, typing cmd.exe and hitting the Enter-key on the keyboard.

Running compact on its own displays the compression status of all folders and files of the current directory.

ADVERTISEMENT
The command line tool support several parameters, some of which may be confusing at first.

The core commands compact.exe /c and compact.exe /u mark the current or specified directories so that future changes to the folder, e.g., modified files or newly added files, are compressed or uncompressed.

It is necessary to supply the /s parameter to the command to perform the selected operation on all files in the specified directory and all of its subdirectories.

ADVERTISEMENT
By default, the current directory is used, but a directory may be supplied to perform the operation on a different directory instead. To do that, add path information to the command.

The command compact.exe /c /s:c:\users\test\downloads\ runs the compression on the downloads directory.

You may specify the compression algorithm by supplying the /EXE parameter. The parameter /EXE:XPRESS8K uses that algorithm. The following algorithms are supported:

XPRESS4K (fastest and default value)
XPRESS8K
XPRESS16K
LZX (most compact)
The default algorithm is designed to make the performance impact as minimal as possible, even on older systems. Most devices should not have issues using the 8k or even 16k algorithm instead.

Other useful parameters of compact.exe:

/f forces the compression or uncompression. Already compressed or uncompressed files are skipped. Should be used if the process was interrupted, e.g., by a crash.
/i ignores errors and continues the operation without stopping.
/? displays help information.
Closing Words
Large program and game folders, and folders with large uncompressed files, benefit the most from the compression. Gigabytes of disk space may be recovered with the help of the command. Most Windows users may use the CompactGUI program instead, as it is easier to use and handle.

Drop your comment

Related Post

Leave a Reply

Your email address will not be published.