MS-DOS Defrag command
The Defrag command is an external command that is available in the below Microsoft operating systems.
- MS-DOS 6.0 and above and all versions of Windows.
Windows Vista and later syntax
DEFRAG <volumes> | /C | /E <volumes> [<task(s)>] [/H] [/M | [/U] [/V]]
Where <task(s)> is omitted (traditional defrag), or as follows:
/A | [/D] [/K] [/L] | /O | /X
Or, to track an operation already in progress on a volume:
defrag <volume> /T
|/A||Perform analysis on the specified volumes.|
|/C||Perform the operation on all volumes.|
|/D||Perform traditional defrag (this is the default).|
|/E||Perform the operation on all volumes except those specified.|
|/H||Run the operation at normal priority (default is low).|
|/K||Perform slab consolidation on the specified volumes.|
|/L||Perform retrim on the specified volumes.|
|/M||Run the operation on each volume in parallel in the background.|
|/O||Perform the proper optimization for each media type.|
|/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.|
Windows XP and earlier syntax
defrag volume [/a]
defrag volume [/a] [/v]
defrag volume [/v]
defrag volume [/f]
|/A||Analyzes the volume and displays a summary of the analysis report.|
|/V||Displays the complete analysis and defragmentation reports.
When used in combination with /a, displays only the analysis report. When used alone, displays both the analysis and defragmentation reports.
|/F||Forces defragmentation of the volume regardless of whether it needs to be defragmented.|
MS-DOS 6.0 and earlier syntax
Below is a listing of available switches in MS-DOS Defrag 6.0 and above. It is important to note that these commands will not work in Windows 95 and above and defrag should never be ran while Windows is running in the background.
DEFRAG Drive: /F /U /S:order /B /Skiphigh /LCD /BW /G0 /A /H
|Drive:||Drive letter that you want to defragment.|
|/F||Insures that no empty space remains between files.|
|/U||Leaves empty space if any is found between files.|
|/S:order||Sorts files in specific sort <order>.
N = Alphabetic name order.
-N = Reverse alphabetic name order.
E = In alphabetic file extension order.
-E = Reverse alphabetic file extension order.
D = In date order (earliest to latest).
-D = Reverse date order (old to new).
S = By file size (small to large)
-S = By file size (large to small)
|/B||Reboot computer after completing defrag.|
|/Skiphigh||Load defrag into conventional memory.|
|/LCD||Start defrag in LCD color mode.|
|/BW||Start defrag in black and white color mode.|
|/G0||Disable mouse and character set.|
|/A||Start defrag in automatic mode.|
|/H||Move hidden files.|
Defrag the main hard drive and correct any fragmented files.