Put the Squeeze on Files with Compact.exe

Posted on March 8, 2012 by Jeff Hicks in Windows Client OS with 0 Comments


Maybe it is my Midwestern heritage, but I like to be thrifty and economical. Perhaps that is why I like file compression; I can keep the file but only consume a minimal amount of space. Back in the day we typically turned compression on at the folder level, which is still probably a good thing. But sometimes you might want to take a more granular approach. Turns out you can accomplish both with a command line tool called Compact.exe.

Using Compact.exe

First, how do we use Compact.exe? As with most command line tools, let’s start by asking for help:

Compact.EXE Help Example

Figure 1: Compact.exe Help

Now let’s check the status of folder. For this to work properly you need to be at the folder root.


This folder has no compressed files. If you run the command without /Q you’ll get details for all the files. I know there are a lot of text files which compress well so I’m going to compress them like this:


That looked pretty successful! The /S told the utilty to recurse through all the subfolders as well and compress any TXT files. I have a few other file types in C:\Work that will also compress well.

After looking at the results almost all of the folder is compressed so I might as well simply turn on compression at the folder level. This ensures that any new file will automatically get compressed.

This didn’t compress any additional files, just marked the folder as compressed. If at some point I felt the need to uncompress everything it is this easy:

Now all the files are uncompressed and C:\Work is back to normal.


Compact.exe is a very handy and easy to use utility, but I suggest testing it out in a non-production environment to avoid any surprises.