Configure Disk Defragmenter From The Command Line In Windows 7

One of the easiest ways to keep your computer running smoothly is to defragment your hard drives on a regular basis. As with previous versions of Windows, Windows 7 includes a defragmenter tool called the Disk Defragmenter. However, the version included with Windows 7 lets you configure it from the command line.

You can defragment your hard drive from the command prompt by typing defrag. In addition, you have the following options:

  • /r to defrag multiple drives simultaneously
  • -a to perform a defrag analysis
  • -v to print the report
  • -r to treat files with at least 64 Mb of fragments like they are not fragmented
  • -w to defrag everything
Article Written by

  • TeoD

    I believe these CLI options were available in the (lousy) Vista defragger too, but even the CLI option did not erase so many of the shortcomings of that utility. I don’t think 7 is all that much different.

    If you’re willing to go the payware route, then there are some really interesting options such as an automatic defragger that prevents (rather than waiting to ‘cure’) fragmentation. It was reviewed here recently.
    http://wp3.lockergnome.com/blade/2010/01/16/diskeeper-professional-2010-2-month-review/

    A very innovative approach to an old problem.