Sunday, November 29, 2009

Add Disk Cleanup and Defragment to the Right-Click Menu for a Drive

Usually when we want to access the Disk Cleanup Or Disk defragment tool, we normally have to either find it through the start menu, or open up the drive properties window. Instead of going through all that, we can use a simple step to add a menu item to the drive right-click menu.

Steps :

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

HKEY_CLASSES_ROOT\Drive\shell

To add Disk Cleanup :

Create a new key called “diskcleanup” and set the default value to “Disk Cleanup”. Then create another key underneath it called “command” and set the value to the following:

cleanmgr.exe /d %1

To add Disk Defragment :

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.

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

The change should be immediate, just right-click on the drive and you should see the new menu item.

No comments:

Post a Comment