Add "Defragment" to the Right-Click Menu for Drives - Windows 7/Vista Go Back

In this tutorial, I show you how to add a convenient right-click defragment option in the context menu for drives. You can either download the two registry files below or edit the registry manually to apply this change. When you click on "Defragment," a command-line version of Disk Defragmenter will run and then close automatically when finished.

Right-Click Defrag

Disk Defragmenter

Automatic Method:
Download this zip file and extract the two files. The first registry file will add the neccesary entries. The second will remove them. Run the file to merge it with your registry.

Manual Method:
Begin by opening the Start Menu and type regedit into the Search or Run box. Press the Enter key.

regedit

Once the Registry Editor is running, navigate to HKEY_CLASSES_ROOT\Drive\shell.

Registry Editor

Registry Editor - HKEY

Right-click on shell, go to New --> Key, and click on it. Type runas beside the small folder icon and press Enter to name it.

Registry Editor - New Key

Registry Editor - New Key - runas

Now right-click on (Default) in the right pane and click on Modify. Under Value data:, type Defragment and click OK.

Registry Editor - New Key - runas - default

Registry Editor - New Key - runas - default - data value

Next, right-click on runas in the left pane, go to New --> Key, and click on it. Type command beside the small folder icon and press Enter to name it.

Registry Editor - New Key - runas - command - key

Registry Editor - New Key - runas - command

Finally, right-click on (Default) in the right side pane and click on Modify. Under Value data:, type defrag %1 -v and click OK. Close the Registry Editor.

Registry Editor - New Key - runas - command - Default - Modify

Registry Editor - New Key - runas - command - Edit String

Share On: