Click to Rate and Give Feedback
TechNet
TechNet Library
Windows
Windows Server
A-Z List
 Defrag
Defrag

Updated: September 28, 2007

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

Membership in the local Administrators group, or equivalent, is the minimum required to run this command.

For examples of how this command can be used, see Examples.

Syntax

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

Parameters

 

Parameter Description

<volume>

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

-c

Defragments all volumes on this computer.

-a

Performs fragmentation analysis only.

-r

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

-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.

Examples

To defragment the volume on drive D, type:

defrag d:

To defragment all volumes on your computer, type:

defrag -c

To perform a full defragmentation of a volume mounted on drive D, even if free space on the drive is low, type:

defrag d:\vol\mountpoint – w -f

To perform a fragmentation analysis of drive D, and to see a detailed output of the results, type:

defrag d: -a -v

Additional references

Tags What's this?: -c (x) d (x) -i (x) Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
the -i option      Dr_Al_Larson   |   Edit   |   Show History
Webserver 2008 has defrag set up with a -i option. It is not documented here. What does it do?
Tags What's this?: Add a tag
Flag as ContentBug
Windows Server 2008 R2      PPatrick   |   Edit   |   Show History
this defrag command-line reference is for Windows Server 2008 R2 too, but in this case the parameters have changed (as they did for Windows 7 aswell). Where is the detailed information for the command-line defrag.exe of Windows Server 2008 R2?
Tags What's this?: 2008 (x) defrag (x) r2 (x) windows (x) Add a tag
Flag as ContentBug
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker