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

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

WBOY
WBOYforward
2023-04-13 15:37:081949browse

Microsoft has 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 little impact on performance 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 bother with this. This tool is also included in Windows 11.

Compact.exe compresses files and folders on Windows without changing file names or making other modifications to the files. Depending on the type of file, compression may save gigabytes of disk space or very little. Files that are already compressed (such as JPG image files) will show little to no gain when compression is run on them. On the other hand, uncompressed files may show significant gains. You can check out this GitHub page which lists hundreds of games and programs and the savings when using compress.exe on them.

Some applications and games may react adversely to compression. If this is the case, unzipping will solve the problem.

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 turn on the option. You can find "Compress this drive to save disk space" under General in the Properties window.

Using compact.exe on Windows

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

You can run this program from any command prompt window. Open a new Command Prompt window, for example, using Windows-R. Open the Run box, type cmd.exe and press the Enter key on your keyboard.

Running compact alone will display 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.

Core commands compact.exe /c and compact.exe /u mark the current or specified directory so that future changes to the folder (such as modified files or newly added files) will be compressed or decompressed.

The /s parameter needs to be provided 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 one can be provided instead of performing operations on a different directory. To do this, add the path information to the command.

Command compact.exe /c /s:c:\users\test\downloads\ Run compression on the download directory.

You can specify the compression algorithm by supplying the /EXE parameter. Parameter /EXE:XPRESS8K uses this algorithm. The following algorithms are supported:

  • XPRESS4K (fastest and default)
  • XPRESS8K
  • XPRESS16K
  • LZX (most 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 8k or even 16k algorithms.

Other useful parameters for compact.exe:

  • /f Forces compression or decompression. Compressed or uncompressed files will be skipped. Should be used if the process is interrupted (for example, crashes).
  • /i Ignore the error and continue without stopping.
  • /? Display help information.

The above is the detailed content of How to use compact.exe to free up disk space on Windows. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yundongfang.com. If there is any infringement, please contact admin@php.cn delete