Skip to content

Published: December 7, 2015 | Applies to:

Learn how to compress Windows 10 OS installation and gain extra space on HDD to accommodate other stuff. Also learn how to uncompress Windows 10 OS.

Microsoft has hardly coded Windows 10 with the optimization techniques they’ve achieved since days of Windows XP. Along with many new features, there are some useful and handy additions as well in the algorithm of this operating system (OS). Compact command line tool is one of those inclusions which helps you to compress the whole OS installation. As longs as you’re on New Technology File System (NTFS) file system, Compact gives you good zipping results with typically compression ratio 1.5~1.8 to 1.

Windows 10 System Compression Using CompactOS

CompactOS is basically a command line switch which can be executed with Compact command line tool. The general syntax for Compact is as follows:

COMPACT [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [/EXE[:algorithm]] [/CompactOs[:option]] [filename […]]

The parameters can be varied for their corresponding usage:

PARAMETER
USAGE
/C Compresses the specified files.
/U Uncompresses the specified files. Directories will be marked so that files added afterward will not be compressed.
/S Performs the specified operation on files in the given
directory and all subdirectories. Default “dir” is the current directory.
/A Displays files with the hidden or system attributes. These files are omitted by default.
/I Continues performing the specified operation even after errors have occurred. By default, Compact stops when an error is encountered.
/F Forces the compress operation on all specified files, even
those which are already compressed. Already compressed files are skipped by default.
/Q Reports only the most essential information.
/EXE Use compression optimized for executable files which are read frequently and not modified. Supported algorithms are:

  • XPRESS4K  (fastest) (default)
  • XPRESS8K
  • XPRESS16KLZX (most compact)
/CompactOs Set 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.
filename Specifies a pattern, file or directory.

As you can observe that /CompactOS parameter is of our interest here as it directly compress OS installation. Here is illustration of this:

How To Compress Windows 10 OS Installation

CAUTION: Before running either of compression commands below, make sure your system has enough battery. Executing these command may take a while, depending upon your system configuration. In case, if power fails during compression or uncompression, whole installation may mess up. Suggest you for creating a System Restore point as well.

1. Open administrative or elevated Command Prompt.

2. Type following command and hit Enter key:

compact /compactos:query

This will detect the current compactness state. For default condition, you may get typical The system is not in the Compact state because Windows has determined that, it is not beneficial for this system message which clearly shows that system is not compressed. Then run following command:

compact /compactos:always

How To Compress Windows 10 OS Installation

So now your system installation is compressed and you can verify it in File Explorer. To un-compress the installation later, you’ve to run this command:

compact /compactos:never

Hope you find the command useful!


SHARE: Facebook Google+ Twitter

Leave a Reply

Your email address will not be published. Required fields are marked *

What's New


Recent Comments

  • frozen nerd : i also tried uninstalling avast, disabling all startup progr...

    2 hours ago

  • frozen nerd : i have a win 10 home OEM from ASUS tried this and got the ...

    2 hours ago

  • Darren : Thank you, Kapil! The first two netsh commands and reboot ju...

    4 hours ago

  • Charles : I followed your steps but got stuck at step 9 since I couldn...

    9 hours ago

  • Barry : Fantastic! You solved my problem with very clear instruction...

    10 hours ago

  • Keith Fessey : Ok, so whats the difference between the "recovery key" and t...

    14 hours ago


Windows Group Policy Troubleshooting