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.
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
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.
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.
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)
- 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.
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.
Now You: have you used compact.exe in the past?
Thank you for being a Ghacks reader. The post How to use compact.exe to free up disk space on Windows appeared first on gHacks Technology News.