'By Eric M. Bouse
'Tested on WinXP, Win2k

Option Explicit
Dim Shell
Set Shell = CreateObject("Wscript.Shell")

Shell.Run "dfrg.msc"

Wscript.Sleep 5000
Shell.AppActivate "Disk Defragmenter"
Shell.SendKeys "%(A)"
Wscript.Sleep 2000
Shell.SendKeys "D"

Wscript.Quit