Get Detailed Statistics By Running Windows Vista Disk Defragmenter From The Command Prompt



For reasons beyond common sense, Microsoft decided to turn Vista disk defragmenter utility into a faceless tool that no longer displays the graphical overview when running analysis or defragmentation on a disk Volume. While the GUI interface does nothing to report information or status information, a better way to generate detailed reports and perform other advanced tasks is to run disk defragmenter tool from the command line.






Unlike Windows XP disk defragmenter tool, Vista interface only allows you to modify the schedule and start the defrag:



The GUI also does not allow you to defrag individual Volumes, perform an analysis, or provide any useful reporting. Ironically no defrag information can be found in Vista event logs or Performance and Reliability tool.

Fortunately, running disk defragmenter from the command prompt (you will need Admin rights), gives you greater control of which volume or volumes to defrag, allows you to run analysis and view detailed reports. To view disk defragmenter available command line options, open a command prompt and enter the following command:

defrag.exe /?

which displays the following output:

Description:  Locates and consolidates fragmented files on local volumes to improve system performance.

Syntax:  defrag.exe <volume> -a [-v]
defrag.exe <volume> [{-r | -w}] [-f] [-v]
defrag.exe       -c [{-r | -w}] [-f] [-v]


Value                 Description

<volume>              Specifies the drive letter or mount point path of the volume to  be defragmented or analyzed.

-c                        De fragments all volumes on this computer.

-a                        Performs fragmentation analysis only.

-r                        Performs partial defragmentation (default). Attempts to consolidate only fragments smaller than 64MB.

-w                       Performs full defragmentation. Attempts to consolidate all file fragments, regardless of their size.

-f                        Forces defragmentation of the volume when free space is low.

-v                        Specifies verbose mode. The defragmentation and analysis output is more detailed.

-?                        Displays this help information.


Below are defrag.exe examples:

defrag.exe d: (defrag the D: drive)

defrag.exe d:\vol\mountpoint -w -f (defrag the mountpoint while consolidation all file fragments regardless of size and if volume space is low, forces it to defrag)

defrag.exe d: -a -v (run analysis on the D: drive and set verbose mode for detailed output)

defrag.exe -c -v (defrag all volumes on your Computer and set verbose mode for detailed output)


An example output, shown below, runs analysis on the C: drive with verbose mode:



As you can see, a more detailed analysis is shown with information at the bottom indicating that the volume is not fragmented. A similar report will be displayed after fragmenting a volume.

While Vista graphical defrag utility does a nice job of making sure your disk drives are free from fragmentation, using the  combination of defrag.exe from the command line for analysis will finally give you a better picture of your disk volumes that is lacking with Vista.

Read 192 times
Dylan Austin


Whenever I have a problem, I sing. Then I realize my voice is worse than my problem.

We use cookies to improve our website. By continuing to use this website, you are giving consent to cookies being used. More details…