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.

Advertisement

Defragment_Option_Drive_Context_Menu.png

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:

HKEY_CLASSES_ROOT\Drive\shell

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

Advertisement

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)

Add_Defragment_Option_Drive_Context_Menu.png

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

Published in: Windows 7, Windows Vista, Windows XP

About the author: Vishal Gupta (also known as VG) has been awarded with Microsoft MVP (Most Valuable Professional) award. He holds Masters degree in Computer Applications (MCA). He has written several tech articles for popular newspapers and magazines and has also appeared in tech shows on various TV channels.

Comments

NOTE: Older comments have been removed to reduce database overhead.

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

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

  3. 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

Your email address will not be published. Required fields are marked *

NOTE: Your comment may not appear immediately. It'll become visible once we approve it.