Reverse Disk Compression on Windows

Disk Cleanup on Windows XP asks the user if they would like to compress all files on drive to save space. While it does what it advertises, it also makes the computer run significantly slower as it has to use the CPU to decompress each file as it is access before it can be used. A lot of files on a modern computer are already highly compressed - think mp3, ogg, avi, dll (a very relevant one to slow computers) - so drive compression doubles up on the work needed to access their contents for no advantage.

To fix this situation, you will first need to remove enough files from the drive so that decompressing the remainder will not result in running out of space. Once that is done, it's time to turn off compression per volume and then decompress all of those files.

Disabling compression per volume:

  1. Right click on My Computer and select Manage.
  2. Follow the tree on the left to Computer Management -> Storage -> Disk Management.
  3. Right click on the volume that you want to decompress and select Properties - the (C:) volume is normally your system drive and boot partition which was the one causing my grief.
  4. Untick Compress drive to save disk space.
  5. Click Ok and let it do any decompressing it is going to do. It will take a long time.

Reverse compression for all files on a drive (or directory)

This is done on the command line so first up you will need a command prompt:

  1. Open the Start Menu and select Run...
  2. Enter cmd.exe and click Ok.

Next step is to change to the directory you want to decompress. For me, that was the root directory of the C drive. The compact command here will take a long time.

cd c:\
compact /u /s /i

I wanted to uncompress the given directory and all subdirectories, ignoring all errors.

Here are the full set of command line options available:

C:\>compact /?
Displays or alters the compression of files on NTFS partitions.

COMPACT [/C | /U] [/S[:dir]] [/A] [/I] [/F] [/Q] [filename [...]]

  /C        Compresses the specified files.  Directories will be marked
            so that files added afterward will be compressed.
  /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.
  filename  Specifies a pattern, file, or directory.

  Used without parameters, COMPACT displays the compression state of
  the current directory and any files it contains. You may use multiple
  filenames and wildcards.  You must put spaces between multiple
  parameters.