Microsoft included defrag.exe in Windows XP for command-level disk defragmentation.
One of the problems with the welcome addition of the disk defragmenter in Windows 2000 is that it has no command-prompt equivalent. As a result, you can't easily schedule the defragmenter to run. To address this problem, Microsoft included defrag.exe in Windows XP for command-level disk defragmentation.
An example analysis execution shows:
C:\>defrag d: -a
Windows Disk Defragmenter Copyright (c) 2001 Microsoft Corp. and Executive Software International, Inc.
6.91 GB Total, 6.73 GB (97%) Free, 2% Fragmented (5% file fragmentation)
The command format is:
defrag <volume> [-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