How to use compact.exe to free up disk space in Windows
Microsoft introduced new options for the compact.exe command line tool 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 performance impact when the system needs to load files. Files are compressed without changing the file extension or location. Decompression happens at runtime, and most modern systems shouldn’t break a sweat doing it. The tool is also included in Windows 11.
Compact.exe compresses files and folders in Windows without changing file names or making other modifications to the files. Depending on the type of files, compression can save Gigabytes of disk space or very little. Files that are already compressed, for example JPG image files, will show little gain when compression is run on them. Uncompressed files, on the other hand, can show big gains. you can check this GitHub pagewhich lists hundreds of games and programs, and the savings from using compress.exe on them.
Some applications and games may react poorly to compression. If that’s the case, decompression will solve the problem.
Advice: 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’ll find “Compress this drive to save disk space” under General in the properties window.
Using compact.exe on Windows
You can run the program from any command prompt window. Open a new command prompt window, for example by using Windows-R to open the run box, typing cmd.exe and pressing the Enter key on the keyboard.
Run Compact by itself shows the compression status of all folders and files in the current directory.
The command line tool supports several parameters, some of which may be confusing at first.
The main commands compact.exe /c and compact.exe /u mark the current or specified directories so that future changes to the folder, for example, modified files or newly added files, will be 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 its subdirectories.
By default, the current directory is used, but you can provide a directory to perform the operation on a different directory. To do that, add path information to the command.
The compact.exe /c /s:c:userstestdownloads command runs compression on the downloads directory.
You can specify the compression algorithm by providing the /EXE parameter. The /EXE:XPRESS8K parameter uses that algorithm. The following algorithms are supported:
- XPRESS4K (default and faster)
- LZX (more compact)
The default algorithm is designed to have as little performance impact as possible, even on older systems. Most devices should have no problem using the 8k or even 16k algorithm.
Other useful compact.exe parameters:
- /f forces compression or decompression. Files already compressed or uncompressed are skipped. It should be used if the process was interrupted, for example 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 compression. Gigabytes of disk space can be reclaimed with the help of the command. Most Windows users can use the CompactGUI program instead, as it is easier to use and manage.
Now you: Have you used compact.exe in the past?