Compact OS is a new command line tool that Microsoft introduced in the Windows 10 operating system in an effort to reduce the system's disk footprint.
Probably the biggest change to previous versions of Windows in this regard is that Windows 10 does not need recovery images anymore, as the operating system will use existing files for that instead.
Compact OS is a new compression mechanism which takes files of the operating system and puts them in a (hidden) compressed container.
There is a lot that you can do with Compact OS, especially when it comes to optimizing and deploying images.
What's probably most interesting from an end-user's perspective is that you may change from a non-compacted to a compacted OS on a running system.
If you do that, you may free up several Gigabytes of storage on the hard drive because of it. Mileage may vary but I have yet to come upon a system where the Compact OS operation would not free up at least 2 Gigabytes of space.
2 Gigabytes may not be much depending on available hard drive space. Running the operation makes sense if Windows is installed on a partition with little hard drive space, or a Solid State Drive that is low on space.
All commands are run from an elevated command prompt.
Before you do any compacting, you may want to determine the current state of OS binaries to find out whether the OS is already compressed.
Run the following command to determine that:
The command line tool returns information about the state. This includes how many files are compressed or not compressed, the compression ratio, and how many bytes of data are stored in the compressed container.
If the compression ratio is 1,0 to 1 or close to that, then the OS is not compressed.
Compression may impact performance under certain circumstances but it should not be noticeable on most systems.
Please note that you can go back to an uncompressed state at any point in time if you notice issues after compressing the OS. Also, to be on the safe side, it is recommended to back up important data before you continue.
Run the following command to compress OS binaries:
The operation may take several minutes to complete (on some systems 20 or more minutes). The amount of space you save depends on a number of factors. A test on the latest Insider Build installation of Windows 10 saved more than 2 Gigabyte of disk space after the compression.
To revert the change later on, run the following command to uncompress the data:
The operation does not take as long as the compression usually. Windows will occupy more disk space afterwards though so keep that in mind.
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.