You can't schedule Windows 2000's Disk Defragmenter to run automatically because the program's executable file (dfrgntfs.exe) won't run from the command line. However, if you're comfortable with Visual Basic (VB), you can write a program to launch the software, then use Win2K's Task Scheduler to run the program. (For information about Task Scheduler, see the article I cowrote with Kenton Gardinier, "Win2K Task Scheduler," January 2001.) Windows .NET Server and Windows XP—both formerly code-named Whistler—will include a command-line program called defrag.exe. This program is a command-line version of Disk Defragmenter, and you can use Task Scheduler to schedule defrag.exe to run automatically.

System performance really suffers when a machine's paging file is fragmented, but you can't use Disk Defragmenter to directly defrag that file. However, if the computer has a second volume with plenty of free space, you can work around this restriction. For example, suppose your paging file is on the C drive and that you have plenty of space on your D drive. Defrag the C drive and create a paging file on the D drive. Then, set the size of the paging file on the C drive to zero (effectively removing the file). Reboot the machine, then create a new paging file on the C drive. Set the size of the paging file on the D drive to zero, then reboot again. Because you've defragged the C drive, it should contain enough contiguous free space to let Win2K create a contiguous paging file.