3

My friends laptop (a 64-bit Windows 7 Home Premium with 4GB RAM) was running slowly and she asked me to take a look at it. One of the things (besides that the disks had not been defragmented for a long time, and some other things) is that she had ticked the checkbox "Compress this drive to save disk space" on the OS disk.

Since this is one thing that could make the OS run a bit slower I decided to untick the checkbox. After starting the decompression process, Windows estimated that it would take 16 hours to complete. However about 30 minutes later the OS suddenly shut down.

After restarting the machine I noticed that about half of the top-level folders have been decompressed, and half have not. On the root level the "Compress this drive" checkbox is however unticked.

Is there a way to launch the decompression of files through e.g. a command prompt?

1
  • 1
    Here is a hint on how to resolve your issue (though not an answer to your question): choose compress in C:, and then select 'only this folder'. It will be done in some seconds. Then choose your desired 'uncompress' in C: again, and select 'all subfolders'. - btw, from my experience Windows is faster with compression on, as less data is going to/from the hard disk; I always use it. But different people have different opinions on that. – Aganju Apr 23 '16 at 23:46
5

Yes, its called the "compact" command.

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Windows\system32>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.

More information here

3
  • 1
    If I were in @x457812's shoes, I would probably snag JPSoft.com's TCC/LE and run: global /i for %X in (*.*) do echo Compact /U %X (and then remove the word "echo" after confirming that I like what I see). The point of the "global /i" is to run the command in every subdirectory, though there are other ways to accomplish that task (without needing to use TCC/LE). – TOOGAM Apr 24 '16 at 16:14
  • Yup, agree, but that's not what they asked, You can post that as an answer as an alternate solution to the compact command built into Windows, which may not be as powerful as what you suggest. – Moab Apr 24 '16 at 18:24
  • This is "a way to launch the decompression of files through e.g. a command prompt". So, it is what x457812 asked. It is also not really an "alternate" solution, as it directly uses the "Compact" command that your answer referred to. The only reason for third party software was a directory crawler. Actually, even that is unnecessary now that I'm noticing the /S option. – TOOGAM Apr 24 '16 at 23:48
1

While the above answer is correct for dealing with an already existing drive it is useful to do this when spinning up a new drive (such as a RAM Drive) at creation time.

This can be done in Windows by appending the /c argument to the format command.

From the documentation:

/c NTFS only. Files created on the new volume will be compressed by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.