Defragment your Hard Disk from Command prompt.

In this age of GUI (Graphical User Interface) it’s not tough task for us to do any system maintenance operations. But it’s a simple fact that when we are doing operations from command line it’s more flexible and we can have more control on our operations also you have so many options to try out and tweak.

Now we can try out how we can perform a hard drive defragment though command line with Defrag.exe utility.

Open your command prompt. (Type CMD on RUN/SEARCH BOX and click enter).

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

1.       Defrag <volume> where you need to specify the drive letter. (Example C,D,E etc)

2.       Defrag  /C – This parameter will defragment all the local volumes on your pc.

3.       /E – With E parameter you can specify which particular volume you want exclude.

4.       /A – This parameter displays a fragmentation analysis report for the specified volume without defragmenting the volume.

5.       /X – This parameter is used for free space consolidation means you can use to free up/shrink the files and also to shrink future files.

6.       /T – To track a defrag operation which is undergoing.

7.       /H – To perform defrag operation on Higher priority.( useful to do it when you system is free and you are not using you pc simultaneously for other operations.)

8.       /M – To perform defrag on multiple volume (Mainly used when you drives like SCSI or additional HDD).

9.       /U– To print the defrag operation /progress on screen.

10.   /V– This is called the verbose mode, for advance users to display additional details and statistics.

Hope this helped, do comment. 🙂

Subscribe To Get FREE Tutorials!

SK is the Founder of Techdunes. Loves blogging on Technology. Follow him on Twitter at @funmansk. Contact him at : admin(at)


  • kiran

    I really miss the GUI of the Windows XP defragmenter in the newer versions. But then again even otherwise the windows defragmenter is still very slow and sometimes has a mind of its own deciding what to defrag and what to skip! I now simply run one of the commrcial defraggers that set to auto will defrag beautifully without any work from my part:) Works great for me.