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 mentioned 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 to create 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!

1 Comment

Add your comment

  • K Jayakumar P Menon

    Dear Kapil Ji, Please help me fine a solution to fix this “Windows can’t be installed because This PC uses a compressed operating system”, I have tried un-check the tick mark from the property sheet general tab of root drive but failed as the check box tick mark does not disappear as many as times I tried. Await your advice.

  • Leave a Reply

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