How To Use the Command Line for More Control over Windows Defrag

The graphical version of Windows 7 Defrag utility seldom offers much control over the defragment process. If you are a power user and want more complete control over the defragmentation process in Windows 7, then Microsoft provides you with the command line version of  the Defrag utility.

The command line version of Defrag (Defrag.exe) offers a number of options (command line argument or command switches) for the user to fiddle with all the features and control it offers. In this article, you will learn about the different command switches available that Defrag.exe offers you. You just need to append those switches according to your need.

How to open defrag.exe through command line?

  • First, click on the Star Orb (Start Button) and type cmd in the Start Menu Search box.
  • Right-click on cmd and select Run as administrator, to open an elevated command prompt.
  • Now type Defrag.exe followed by the options according to your need in the following syntax:

Defrag <volume> | /C | /E <volumes> [/A | /X | /T] [/H] [/M] [/U] [/V]

Note: Defrag syntax used for Windows 7 is different from the syntax used for defrag in Windows Vista.

Explanation of all the command line options available for Defrag.exe:

  • <volume> The drive letter or mount point of the volume to defragment (for example, to defragment D: drive, type d: or if you want to defrag a mount point, d:\vol\mountpoint)
  • /C Defragment all local volumes on the computer.
  • /E Defragment all local volumes on the computer except those specified.
  • /A Display a fragmentation analysis report for the specified volume without defrag¬menting it.
  • /X Perform free-space consolidation. Free-space consolidation is useful if you need to shrink a volume, and it can reduce fragmentation of future files.
  • /T Track an operation already in progress on the specified volume.
  • /H Run the operation at normal priority instead of the default low priority. Specify this option if a computer is not otherwise in use.
  • /M Defragment multiple volumes simultaneously, in parallel. This is primarily useful for computers that can access multiple disks simultaneously, such as those using SCSI- or SATA-based disks rather than disks with an IDE interface.
  • /U Print the progress of the operation on the screen.
  • /V Verbose mode. Provides additional detail and statistics.

Just use the switches as described above and take control over the whole defragmentation process using defrag in Windows 7.

You may also like...