How to schedule a task to run Disk Defragmenter automatically ?
1. Open Control Panel, double-click Scheduled Tasks (Under "Performance and Maintenance" in XP)
2. Double-click Add Scheduled Task and click Next.
3. Click Browse, navigate to your C:\Windows\system32 folder, select defrag.exe
4. Use the wizard to set a schedule, and be sure to supply a password for the account to run the command.
5. Check the box for "Open advanced properties dor this task when I click Finish"
6. On the Run line, add the drive letter for the drive to be defragged. For example:
c:\windows\system32\defrag.exe c: -f
The "-f" switch at the end forces defragmenting drives with less than 15% free space.
defrag.exe is a command line tool. The dfrg.msc GUI program can't be scheduled to run automatically.
Only one instance of defrag.exe can run at a time. If defragmenting multiple drives, the tasks need to be spaced in time enough for previous ones to finish.
The account to run the command must have a non-empty password set.
Scheduling defragmentation once a month is often enough for most home/SOHO users.