Windows XP comes with Disk Defragmenter, which is a slimmed down version of Executive Software's Diskeeper disk defragmentation program. This utility is accessible via the Computer Management Microsoft Management Console (MMC) and as a stand-alone utility on the Tools tab of each hard drive's Properties dialog box.
There's also a command-line version of this utility called Defrag. If you want to quickly configure and launch a defragment operation, it's easier to use the command line rather than accessing the GUI version and then drilling down through a number of options.
To run Defrag, open a command prompt window and type the following command:
Defrag x: [/parameter]
In this example, x is the drive letter of the hard disk you want to defragment, and parameter is one of three optional settings that you can use to configure Defrag:
When you use either the /a or /v parameters, Defrag displays the results on the command line. However, if you'd rather have the results available as a file, use the DOS redirection symbol to send the report to a file. For example, you can redirect the results to a file called Defrag-Results.txt by using this command:
Defrag x: [/parameter] > Defrag-Results.txt