Bill Detwiler: Windows power users normally run the operating system's Defragment and Disk Cleanup utilities as part of their regular system maintenance. And while you can access these tools through various Windows menus and applets, those who use them frequently might want a quicker option.
I'm Bill Detwiler, and during this episode of TR Dojo, I'll show add the Defragment and Disk Cleanup commands to the Windows context menu so that they're both just a right-click away
The steps I'll outline during this episode will let you launch both the Defragment and Disk Cleanup utilities by right-clicking a hard drive's icon from within Windows Explorer.
As this requires editing the Windows registry, make sure you have a reliable backup before you make any changes. Improperly editing the registry can have seriously consequences.
So open the Registry Editor and navigate to HKEY_CLASSES_ROOT\Drive\shell.
Create a new key under this section by right-clicking shell and selecting New | Key. Name it runas. Now, right-click the new runas key and select Modify. Set the Default value to Defragment.
Now select the runas key, right-click it, and select create a new key. Name this key "command" and give it a default value of defrag %1 -v.
And close the registry editor.
Now if you open up Windows Explorer and right-click a drive, you will see Defragment as a choice in the menu. Depending on the version of Windows you use, when you click on the Defragment option, you may have to give Windows permission to run the task.
Now let's do the same thing for Disk Cleanup. From within the Registry Editor, navigate back to the key HKEY_CLASSES_ROOT\Drive\shell.
Create a new key under shell named diskcleanup and give it a default value of Disk Cleanup.
Now create a child key by right-clicking on diskcleanup and selecting New | Key. Name it command (as we did with the defrag key) and enter a default value of cleanmgr.exe /d %1.
Close the registry editor.
Now when you go to My Computer, right-click one of the drives in the list, and you will see the Disk Cleanup menu entry right next to the Defragment entry.
For those who want quick access to Windows' defrag and Disk Cleanup tools, these tweaks can be real time savers. And if you'd like to know how to hide your new right-click options and only have them appear when you press a certain key, check out this article from Jack Wallen. I'll link to it from the TR Dojo blog.
And as always, for more teachings on your path to becoming an IT Ninja, visit trdojo.techrepublic.com, or you can follow me on Twitter at twitter.com/billdetwiler.
Thanks for visiting the TR Dojo.