How to Add “Defragment” Option in Drive Context Menu in Windows

Hard disk fragmentation causes your hard disk do extra work which slows down your computer. Disk Defragmenter tool in Windows rearranges fragmented data so that your hard disk drives can work more efficiently.

You can access it using Drive Properties or All Programs menu. Wouldn't it be great if you can launch it directly by right-click on a drive?

In this tutorial, we'll tell you how to add "Defragment" option in Drive context menu so that you can launch it quickly and easily.


Simply follow these simple steps:

1. Type regedit in RUN or Start Menu search box and press Enter. It'll open Registry Editor.

2. Now go to following key:


3. Under "shell" key, create a new key Defragment

4. If you want to show an icon for context menu option, select "Defragment" key and in right-side pane, create a new String icon and set its value to defrag.exe

PS: You can also change its position in context menu using position String. Check this topic for more information.

5. Now create another new key under Defragment key and give it name command

6. Select command key and in right-side pane, change value of default to any of following:

defrag.exe /u /v %1 (for classic command line screen)
dfrgui.exe (for new graphical interface)


That's it. Now you can access the option in drive context menu.

PS: If you want a ready-made registry script to do the task automatically, simply download following ZIP file, extract it and run the extracted REG file. It'll ask for confirmation, accept it:

Download Registry Script

Share this article: Facebook | Twitter | Google+ | Reddit | Tell a friend

Posted in: Windows 7, Windows Vista, Windows XP

Other similar articles that may interest you


  • Thanks a lot for posting :)

  • nice tutorial

  • Cool! This means I can use another defrag tool I want by changing the value for Data. Am I right VG?

  • Maybe you should make commands for it :
    Scan for error : CHKDSK.EXE
    Scan and Repair Errors : CHKDSK.EXE /F

  • I havent tried this. Actually for defrag I am trying out a commercial trial version at the moment and am seriously inclined towards dumping the built in (I run Vista) defragmenter for this automatic programs as it seems to have done a really gud job after I just set it to run in the background. If I dont need to check or analyze the fragmentation or free space or even turn off the programs, what could be better!

Leave a Comment