Tip

Automating disk defragmentation

After you install a lot of applications on a server, systems administrators should run Disk Defragmenter on a regular basis so they can run efficiently. However, that may be difficult to do on timely basis because of your busy schedule.

Today, it's possible to put an end to disk defragmentation as a manual process by scheduling disk defragmentation via the Windows Task Scheduler. Windows XP and Windows Server 2003 both include a new way to invoke the Windows Defragmentation tool via the command line. (In prior versions of Windows, there was no way to invoke this tool with the Command Line.)

Here is an example of the usage of defrag.exe:

defrag.exe -v d: >c:templogfile.txt

This command will begin the Defragmentation of the target machines D: drive.

The v switch enables verbose logging of the location specified at the end of the command. Now you can create a batch file using the above command without manually performing the task of disk defragmentation.

Please let us know how useful you find this tip by rating it below! If you have a useful Windows tip, timesaver or workaround to share, submit it to our

    Requires Free Membership to View

tip contest and you could win a prize!

This was first published in August 2006

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.