Dig Deeper in Windows Defrag via Command Prompt

Posted: December 10, 2010 in Tips and Tricks, Windows 7

Windows users have learned over the years that they need to keep their computers defragmented to keep running at top speed. While Windows Vista and 7 automatically defrag your disks, here’s some ways you can dig deeper into Windows Defragmenter.


Windows Disk Defragmenter was turned into a very stripped down utility in Windows Vista and 7. In fact, Vista’s Disk Defragmenter didn’t even let you select the disks to defragment until it was updated in Service Pack 1. The good thing, though, is that both Vista and 7 automatically defrag your disks on schedule, so for the most part you don’t need to think about it.


Do note, however, that for the most part you’re not going to see massive performance jumps by defragmenting a disk. Actually, upgrading to an SSD would be the best way to improve your disk performance, and by the way, Don’t run defrag on an SSD drive!
SSD drives do not need to be defragmented, and you actually decrease your drive’s performance by defragging it.

Using the Disk Defragmenter App

If you do open the defragmenter app, you may be surprised to find how space it is. It lets you analyse or defragment individual disks; hold your Ctrl key to select multiple disks and defragment your whole system at once. You can also change the defragment schedule. By default, most computers will be set to defrag at 1AM Wednesday mornings, but you can change this if you’d rather it defrag at a different time or if your computer’s never running then.

But that’s all you can do with the Defragmenter app. To dig deeper, we need to head over to the command prompt.

Defragging from Command Prompt

The Windows defragment tool actually has tons of features, but you just can’t access them from the window interface. To dig deeper, open command prompt in Administrative mode.

To use the defrag tool, just enter defrag followed by the parameters you want to use. As usual, you can view the command’s help file by entering defrag /?. Then to use defrag, just enter the following, like you would with many command apps.

defrag [name of your drive] [parameter] [extra parameters]

So, to simply defrag your drive, just enter defrag [drive name]. If your main drive is C:, then just enter defrag C: to defrag your main C drive. There’s tons more you can do with the disk defragmenter, as you can see from the included help info.

So, with that in mind, let’s dive in and look at some of the most common parameters you might want to use:

See if you need to defrag

Not sure if your hard drive needs defragmented? Just analyse your disk by entering

defrag [drive name] /A

As you can see below, we entered defrag
C: /A to analyse our C drive. After a few moments, you can see how large your drive is (Or partition if your hard drive is in multiple partitions), how much free space it has, the total fragmented space, and largest free space segment. Underneath, the defrag tool will tell you if it thinks you need to defrag now or not.

Defragment all your drives at once

Would you like to just defragment all of your drives without getting extra info or doing a more complicated defrag? If so, just enter defrag /C and let defrag take over. Or, hey, you could just do this from the main defrag window since it works the exact same.

Other Nice Options

Get more info about the defrag:     /V

Consolidate free space on a drive:     /X

Defrag at normal process priority:     /H

Track a defrag already in progress:     /T

Defrag all drives except the one listed:     /E

Defrag all drives at the same time:     /M – note, this is only advisable if you have multiple drives, and will not work good on a computer with multiple partitions

You can put the options you need together, too. Say you want to defrag all of your devices in verbose mode to see more info, and you also want the defrag to run at top priority. To do this, we’ll enter:

defrag /C /H /V

Once it’s running, you’ll see the list of the options you’ve selected on the top of the command prompt window. Remember to not close the window before the defrag is finished, as this will kill the process.

Now that you’ve got more control over defrag, you can hopefully get your disks running at top performance. Or, even if you don’t want to tweak anything, just running defrag /C is much geekier than opening the Disk Defragmenter. We recently asked readers if they use the command prompt; if you’re not in the habit of using it, here’s a good chance to get started!

  1. kim says:

    I find the defragger slow and the scheduled defrags very unreliable for serious defragmentation. The visual display which was present in XP was a great help, moreover the scheduled tasks sometimes dont finish efficiently. I find that although they come at a price, some of the third party commercial defraggers offer very useful features like defragging under less than 5% free space, real time mode etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s