Set a Scheduled Task to run defrag from a .cmd or .bat file


I had a request for this today , so I thought I would plop it on my blog.


I set this for all of my workstations, to run a daily defrag.

The following command will set a daily defrag to start the given date & time, feel free to change the dates and times.

schtasks.exe /create /SC DAILY /TN fragme /TR ""C:windowssystem32defrag.exe"c: -f" /ST 00:45:00 /SD 03/04/2008 /RU SYSTEM

Copy the following, and put it in a .CMD or .BAT file and your set.


This will make a scheduled task.

Written by Roger Lund

VMware and Storage crazy man, vExpert, MN VMUG leader