Subscribe to Windows IT Pro
September 17, 2001 12:00 AM

Work Around the Limits

Windows IT Pro
InstantDoc ID #22255
Rating: (0)

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.

Related Content:

ARTICLE TOOLS

Comments
  • larry boswell
    9 years ago
    Oct 27, 2003

    yes what do i go to to defrag c drive to much on files and folders went to yesrerday evening to my computer and pulled up a defrag.exe and never got past 2 percent through kept saying 0 to 2 percent left in like that all nite didnt work

  • Alex Murray
    9 years ago
    May 13, 2003

    Watch out - SpyBot reports that this page attempts to download "MediaPlex" - a known threat.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.