Jump to content

Defrag from the command line


Recommended Posts

Defrag from the command line

Windows XP comes with Disk Defragmenter, which is a slimmed down version of Executive Software's Diskeeper disk defragmentation program. This utility is accessible via the Computer Management Microsoft Management Console (MMC) and as a stand-alone utility on the Tools tab of each hard drive's Properties dialog box.

There's also a command-line version of this utility called Defrag. If you want to quickly configure and launch a defragment operation, it's easier to use the command line rather than accessing the GUI version and then drilling down through a number of options.

To run Defrag, open a command prompt window and type the following command:

Defrag x: [/parameter]

In this example, x is the drive letter of the hard disk you want to defragment, and parameter is one of three optional settings that you can use to configure Defrag:

• /a: Analyzes the volume and displays a summary of the analysis report.

• /v: Displays the complete analysis and defragmentation report. It can be used in combination with /a to display only the analysis report.

• /f: Forces defragmentation of the volume, regardless of whether it needs to be defragmented.

When you use either the /a or /v parameters, Defrag displays the results on the command line. However, if you'd rather have the results available as a file, use the DOS redirection symbol to send the report to a file. For example, you can redirect the results to a file called Defrag-Results.txt by using this command:

Defrag x: [/parameter] > Defrag-Results.txt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...