Sunday, July 28, 2019

Is there a way to toggle the Windows "compress this drive" command through a command prompt?



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?


Answer



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


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...