Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to Automate Disk Defragmenter Using Task Scheduler Tool in Windows XP


View products that this article applies to.

Author:

Ray Dixon MVP

↑ Back to the top


COMMUNITY SOLUTIONS CONTENT DISCLAIMER

MICROSOFT CORPORATION AND/OR ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY, RELIABILITY, OR ACCURACY OF THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN. ALL SUCH INFORMATION AND RELATED GRAPHICS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT AND/OR ITS RESPECTIVE SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THIS INFORMATION AND RELATED GRAPHICS, INCLUDING ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, WORKMANLIKE EFFORT, TITLE AND NON-INFRINGEMENT. YOU SPECIFICALLY AGREE THAT IN NO EVENT SHALL MICROSOFT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY DIRECT, INDIRECT, PUNITIVE, INCIDENTAL, SPECIAL, CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF USE, DATA OR PROFITS, ARISING OUT OF OR IN ANY WAY CONNECTED WITH THE USE OF OR INABILITY TO USE THE INFORMATION AND RELATED GRAPHICS CONTAINED HEREIN, WHETHER BASED ON CONTRACT, TORT, NEGLIGENCE, STRICT LIABILITY OR OTHERWISE, EVEN IF MICROSOFT OR ANY OF ITS SUPPLIERS HAS BEEN ADVISED OF THE POSSIBILITY OF DAMAGES.

↑ Back to the top


MORE INFORMATION

1.  Open Control Panel
2.  Double-click Scheduled Tasks
3.  Double-click Add Scheduled Task
4.  On the Scheduled Task Wizard dialog, click Next
5.  Click Browse
6.  In the Select Program to Schedule dialog, navigate to the windows\system32 folder
7.  Select defrag.exe
8.  Click Open
9.  In the Scheduled Task Wizard dialog, type a name for the scheduled task (Disk Defragmenter, for instance)
10. Under Perform this task, select how often you wish Disk Defragmenter to run
11. Click Next
12. Set the time at which you wish the Disk Defragmenter scheduled task to run.  This should be a time when your computer is on, but not in heavy use.
13. Select the frequency at which you want the Disk Defragmenter scheduled task to run (Every Day, Weekdays, or Every <N> days, where <N> is the number of days between scheduled runs)
14. Click Next
15. Enter a user name under which the Disk Defragmenter scheduled task will run.  Note: This user must be an administrator on the local machine.
16. Enter the password for the user you entered in the previous step
17. Confirm the password for the user
18. Click Next
19. Check Open advanced properties for this task when I click Finish
20. Click Finish
21. In the Run text box, you should see the full path and command for defrag.exe.  By default, this path is C:\WINDOWS\SYSTEM32\defrag.exe
22. Append the drive letter for the drive you wish to defragment to the command in the Run text box.  In a default installation, your Run command will look like this:
        C:\WINDOWS\SYSTEM32\defrag.exe C:
23. Click OK
24. In the Set Account Information dialog, enter and confirm the password for the user listed in Run as
25. Click OK
 
Disk Defragmenter will now run as the specified user on the schedule you specified when you created the scheduled task.
 
For additional information about using Scheduled Tasks in Windows XP, see the following article in the Microsoft Knowledge Base:
        HOW TO: Schedule Tasks in Windows XP
 
For additional information about the limitations of the Disk Defragmenter tool in Windows, see the following article in the Microsoft Knowledge Base:
        How to Defragment Your Disk Drive Volumes in Windows XP
 
For additional information about using the command line Defrag.exe tool, see the following article in the Microsoft Knowledge Base:
        Description of the New Command Line Defrag.exe Included with Windows XP

↑ Back to the top


Keywords: KB555098, kbhowto, kbpubmvp, kbpubtypecca

↑ Back to the top

Article Info
Article ID : 555098
Revision : 5
Created on : 8/19/2020
Published on : 8/20/2020
Exists online : False
Views : 359