MS-DOS Commands :: defrag

Overview:

Warning: This command is for advanced users only!

The defrag command defragments the specified drive. Note: Depending upon the capacity of the drive and the amount of fragmentation, the defragmentation process can take a considerable amount of time to finish (e.g.: hours).

Tip: Unless you have a reason for using the defrag command, instead use the defragmentation tool of Windows Explorer.

Tip: If you want to defragment an individual file (or a group of files) rather than an entire drive, use config instead.

Command Options:

There are a few options you can use with the defrag command. For the complete list of options, type: defrag /?

The following examples demonstrate some of the more useful options:

defrag drive: -v

Defragment the specified drive. Displays verbose information about the analysis and defragmentation. For example, to defragment the c: drive, use: defrag c: -v

defrag drive: -a
defrag drive: -a -v

Do not perform defragmentation, but merely perform an analysis of the current state of the drive's fragmentation. Include the -v option to display verbose information during the analysis. For example, to analyze the fragmentation of the c: drive, use: defrag c: -a -v

defrag /?

Windows Disk Defragmenter
Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.
Usage:
defrag  [-a] [-f] [-v] [-?]
  volume  drive letter or mount point (d: or d:\vol\mountpoint)
  -a      Analyze only
  -f      Force defragmentation even if free space is low
  -v      Verbose output
  -?      Display this help text

(Enlarge: defrag /?)

Related Commands:

config
Defragment the specified file or group of files (e.g.: *.exe) rather than an entire drive.