Friday, December 17, 2010

How to Add Defragment to the Right-Click Menu for a Drive

Manual Registry Hack

Open up regedit.exe through the start menu search or run box, and then browse down to the following key:

HKEY_CLASSES_ROOT\Drive\shell

image

Create a new key under shell called “runas”, and then set the (Default) value to “Defragment”. If you want to hide this menu item behind the Shift key right-click menu, then add a new string called Extended with no value.

image

Next, you’ll need to create a key called “command” and set the default value to the following, which is the command to run defrag with the default options but show verbose output.

defrag %1 –v

 

Making Registry Hack yourself

 

To Add Defrag To Drive Menu

Open Notepad and copy paste following

-----------------------------------------------------------------------------------

Windows Registry Editor Version 5.00

; Add defrag to drive menu

[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Defragment"

[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="defrag %1 -v"

---------------------------------------------------------------------------------

Save it as AddDefragToDriveMenu.reg

 

To Add Defrag To Extended Drive Menu

Open Notepad and copy paste following

-----------------------------------------------------------------------------------

Windows Registry Editor Version 5.00

; Add defrag to extended drive menu

[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Defragment"
"Extended"=""

[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="defrag %1 -v"

---------------------------------------------------------------------------------------

save it as AddDefragToExtendedDriveMenu.reg

 

To Remove Defrag From Drive Menu

Open Notepad and copy paste following:

---------------------------------------------------------------------------------------

Windows Registry Editor Version 5.00

; Remove defrag from drive menu

[-HKEY_CLASSES_ROOT\Drive\shell\runas]

-------------------------------------------------------------------------------------------------

save it as RemoveDefragFromDriveMenu.reg

 

Now you will have three registry files.

Double click on any of the file. If windows asks for your permission give it. There will be a statutory warning, click yes. A confirmation dialogue will appear that the registry entry has been added.

Now right click on the desktop and your will see you desired entry added or removed.

No comments: