One of the cool features in Vista and Windows 7 is it’s set to automatically defrag your hard drive by default on a weekly basis. If you’re still using XP, here’s how you can set it up to work similarly to Vista or Windows 7.

Defragging your hard drive ensures that the data on the disk is in contiguous order for easier access to files and programs. Although the jury is still out on whether or not it improves performance on the newest machines, it’s good to know your drive is always in order. By default, it’s set to run weekly in Vista and Windows 7, and here we’ll look at making it run automatically in XP like it does in the newer versions of Windows.

Defrag in Windows 7 & Vista

Windows 7 & Vista will automatically defrag your hard drive when it’s idle and the feature works well. In Windows 7 it’s set to run at 1am every Wednesday as a low priority background task. Of course you can also change the defrag schedule or turn it completely off if you want.

Defrag in XP

On older XP machines, defragging the drive is a recommended task for best performance, but it’s not enabled by default. There are a couple of ways to access Disk Defragmenter in XP.

A quick way is to go to Start \ Run and type in dfrg.msc and hit Enter or click OK.


Alternately, you can open My Computer, right-click on your local drive, and select Properties.

In the Local Disk Properties screen click the Tools tab, then Defragment Now.

Disk Defragmenter opens and you can analyze your drive, view a report, or kick off the defrag process manually. One of the cool things available in XP Defrag when analyzing your disk is the GUI.

You can still analyze your disk in Windows 7 or Vista, but don’t get the graphical interface.

Make XP Defrag Run Like in Vista or Windows 7

If you want Disk Defragmenter to work like it does in Vista or Windows 7, we need to create a Scheduled Task. Open Control Panel in Classic View and open Scheduled Tasks.

The Scheduled Task Wizard kicks off and when you come to the screen to select the program to run, click the Browse button.

Now enter the following into the File name field and click Open.


Give the task a name…it will be defrag by default but you can name it to whatever you want. Make sure to select Weekly and click Next.

For the Start time enter 1:00 AM, run every week, and for the day select Wednesday.

Note: This is what the Windows 7 default schedule is. Of course you can set it to whatever you want, but here we want to make it the same as the Windows 7 default.

The default user name will automatically be entered, and you’ll need to enter the correct password.

Now that everything looks good and is correctly scheduled, make sure to check Open advanced properties for this task when I click Finish.

When Advanced Properties opens in the Run field after defrag.exe enter a space then the letter of your local drive, in most cases it’s the C: drive…click OK.

You might also want to go into Settings and have your PC wake up to run the task and adjust the idle time.

You’ll be prompted to enter in your login credentials again and click OK.

Now you’ll see an icon for your new Defrag Scheduled Task.

When it runs, the Command Prompt screen will open and run an analysis and complete the defrag process.

You won’t see it running via the GUI but it’s running in the background. If you open up Task Manager you’ll see the process running.

That is all there is to it. Now your XP machine is set to automatically defrag the local hard drive just like it does in Vista and Windows 7. If you want to get a better handle on the defrag feature in all three versions of Windows, we have several different other articles you can check out!