Step-by-Step: Automatic Daily Defragmenting Using Scheduled Tasks
December 7, 2003


Note: This article builds on the previous article: Step-by-Step: Defragment Multiple Hard Drives Using a Batch File.  If you haven't looked at that one yet, please do so before using this article.  Also, this article is for Windows XP only.

Now if your computer is up and running 24 hours a day, we can set it up so that the batch file which defragments your hard drive is run daily without any intervention on your part.  This is good for web or file servers which are left on continuously.

Since we have a batch file ready, all we have to do is set it up to run automatically.  For this, we'll use the built-in Windows XP Task Scheduler.

Start --> Settings --> Control Panel

 

Double-click on "Scheduled Tasks".

 

Double-click on "Add Scheduled Tasks".  You'll see this wizard pop up.  Click "Next".

 

You'll see this window.

Click on "Browse".  Navigate to where you stored the "defrag-hd.bat" file and select "Open".

At this window, click on "Daily".  Click "Next".

 

Here you select what time you want your program to run.  I select that defrag runs every morning at 5:00 am to minimize interference with other server processes.  Click "Next".

 

Here you type in your password to this computer so that the program can run with your authority.  Click "Next".

 

You will see a summary of what is going to happen.  Everyday, the batch file defrag-hd.bat will be run at 5:00 am.  You can simply hit "Finished".

 

You can see the new entry in the Scheduled Tasks menu.

 

In order to test the program, you can right-click on the defrag menu item and select "Run".  Or if you want to edit the settings for the scheduled task, you can right-click on the defrag menu item and select "Properties".

Well, there you have it.  You can now defrag all your hard drives at once with a batch file and you learned how to setup daily hard drive defragmenting. 

Take care,

Brian
 



Step-by-Step: Defragment Multiple Hard Drives Using a Batch File

Additional Information

Step-by-Step: