Defrag


Applies To: Windows Vista,Windows Server 2008

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


Copy Code

defrag <volumes> | /C | /E <volumes>    [/H] [/M | [/U] [/V]]
defrag <volumes> | /C | /E <volumes> /A [/H] [/M | [/U] [/V]]
defrag <volumes> | /C | /E <volumes> /X [/H] [/M | [/U] [/V]]
defrag <volume> /T [/H] [/U] [/V]

Parameters

Parameter

Description

<volume>

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

C

Perform the operation on all volumes.

A

Perform analysis on the specified volumes.

E

Perform the operation on all volumes except those specified.

H

Run the operation at normal priority (default is low).

M

Run the operation on each volume in parallel in the background.

T

Track an operation already in progress on the specified volume.

U

Print the progress of the operation on the screen.

V

Print verbose output containing the fragmentation statistics.

X

Perform free space consolidation on the specified volumes.

?

Displays this help information.

Remarks

Examples

To defragment the volume on drive C while providing progress and verbose output, type:


Copy Code

defrag C: /U /V

To defragment the volumes on drives C and D in parallel in the background, type:


Copy Code

defrag C: D: /M

To perform a fragmentation analysis of a volume mounted on drive C and provide progress, type:


Copy Code

defrag C: mountpoint /A /U

To defragment all volumes with normal priority and provide verbose output, type:


Copy Code

Defrag /C /H /V

Additional references