The Windows Registry is a powerful but confusing component of the Windows operating system. In earlier editions of Windows, editing the Registry was fraught with peril; if the user edited it with the wrong tool or altered a critical key, the result could be an inoperable Windows installation. Windows 7, however, is far more forgiving than its predecessors when it comes to modifying the Registry, if you use the built-in Windows 7 Registry Editor (Regedit).
The Windows 7 Registry is a massive database of settings and configuration data for the operating system and for all of the applications and drivers installed on your PC. When you tweak the Registry, you edit (or create) database entries to customize how your OS works. Always make sure to Before making any changes to the Windows Registry, you should be sure to back up your important data, as missteps in the Registry could impair your PC or even render it inoperable. That said, if you stick to modifying the appropriate entries--or keys--there's little to worry about.
To perform any of the Registry modifications outlined in this article, you must first access Windows 7's built-in Registry Editor. To do so, click the Start button, type regedit in the search field, and press Enter. The Windows Registry Editor will open and present you with what looks like a never-ending tree of expandable menu items.
Five main keys (also called hives) are visible in the Windows 7 Registry (a sixth key, which holds performance data, remains hidden when you use the Registry Editor):
HKEY_CLASSES_ROOT (HKCR) stores settings for all applications, utilities, and programs installed on a system.
HKEY_CURRENT_USER (HKCU) stores settings for the user who is logged in.
HKEY_USERS (HKU) stores settings for all of the user accounts on a given system.
HKEY_LOCAL_MACHINE (HKLM) stores settings specific to the system that Windows is installed on.
HKEY_CURRENT_CONFIG (HKCC) stores settings gathered or determined at runtime, generally when the system boots up.
The name of each main key indicates fairly clearly the settings it governs. If you want to tweak a specific piece of hardware in your system, the setting is probably saved in HKLM; settings for your user account usually appear in HKU or HKCU.
Before you make any changes to the Registry, update your backup files. The Registry Editor makes backing up specific keys, or even the entire Registry, very easy. To back up the whole Windows Registry, highlight Computer in the left pane of the Regedit window, go to the File menu, and click Export. Name your backup file in the resulting window and click Save, and the entire Registry will be saved in one massive file. Keep this file handy on a separate hard drive; if something goes wrong, you can always re-import it to restore your old Registry settings.
You probably won't need a backup of the entire Registry, however. Over the course of this article, we'll be altering only a few keys, so you can limit yourself to creating backups for just those keys. Backing up specific keys follows the same process as backing up the entire Registry, except that instead of highlighting 'Computer' in the left pane of the Regedit window, you select the key that you plan to alter, and export it to a safe place. To restore the backed-up Registry key, double-click the file--it will automatically update your Registry with the old key.
Edit Your Context Menus
Over time, as you install more and more applications and utilities on your Windows system, some right-click context menus (the little menus that pop up when you right-click icons or your desktop) may become cluttered with options. In contrast, most right-click context menus on a clean system list only a few options. If your context menus have become cluttered, it's time to clean house.
Typically, the options listed in your context menus are stored in these five Registry keys:
If you'd like to remove a context menu option, look for its listing in one if these keys. To remove it, highlight the specific key, right-click it, and choose Delete from the menu. Be sure to highlight only the specific key for the context menu item you want to remove, and not the main ContextMenuHandlers, Shell, or ShellEx keys; otherwise, you'll delete the entire menu.
Add 'Open Command Prompt Here' Option for Any Folder
Though they have fewer and fewer reasons to do so, some users (including me) like to perform tasks from a command line. Unfortunately, navigating the myriad folders on a Windows 7 system from a command prompt can be a pain, especially if many of them have long file names.
But it's easy to arrange for Windows 7 to open a command prompt window automatically in the directory being viewed. To do this, open the Registry Editor and navigate to the HKCR\Directory\Background\shell key. Highlight shell; right-click it; and choose New, Key from the menu. Name the new key Open Command Prompt Here. Once you've created the new key, highlight it and again choose New, Key from the menu. Create another key named command. Highlight the newly created command entry, and you'll see in the right Regedit pane that a default string value has been automatically created. In the right pane, highlight (Default), right-click it, and choose Modify from the menu. In the Edit String window that opens, type cmd.exe, click OK, and close the Registry Editor. When you're done, right-click the background of your desktop (or any folder in Windows Explorer) and choose Open Command Prompt Here to open a command prompt with a command line pointing to that directory.
Add a Defrag Option When Right-Clicking Hard Drives
For most Windows users, defragging a hard drive entails opening the Computer menu or the Libraries menu, right-clicking the drive, selecting Properties from the menu, clicking the Tools tab at the top of Properties window, and finally clicking the Defragment Now button. Here's how to arrange to launch the Windows Disk Defragmenter simply by right-clicking your hard drive.
Open the Registry Editor and navigate to the HKCR\Drive\shell key. Highlight shell; right-click it; and choose New, Key from the menu. Name the new key runas. After you create it, a default string value should be automatically appear in the right Regedit pane. Highlight the runas key in the left pane, right-click (Default) in the right pane, and choose Modify from the menu. In the subsequent Edit String window that opens, enter Defragment and click OK.
Next, highlight the newly created runas key again, right-click, and choose New, Key from the menu once more. Create another key named command. Highlight command and, in the right pane, highlight the (Default) value that was automatically created; then right-click it, and choose Modify from the menu. In the Edit String window that opens, type dfrgui.exe, click OK and close Regedit. Now, when you right-click a drive in the Computer window or the Libraries window, the Defragment option should be available.
Pin Applications to Your Background Context Menu
Windows 7 affords users multiple areas to pin shortcuts for their favorite applications. But what if you have an application or utility that doesn't warrant a prime piece of real estate in your Taskbar or Start Menu? Well, you can neatly tuck those apps away in your right-click context menu for quick access.
To pin an application to a context menu, open the Registry Editor and navigate to the HKCR\Directory\Background\shell key. Highlight shell, right-click it, and choose New, Key from the menu. Name the key whatever you like; we chose CCleaner, since we decided to add a shortcut to that handy cleaning utility to our menu. Once you've created your new key, highlight it, and again choose New, Key from the menu. Create another new key named command.
Next, highlight command and once again you'll see that an automatically created default string value now appears in the right Regedit pane. In the right pane, highlight (Default), right-click it, and choose Modify from the menu. In the Edit String window that opens, enter the path to the executable for the application that you'd like to run; in our case we entered "C:\Program Files (x86)\CCleaner\CCleaner.exe" (including the quotes). Click OK, and then close Regedit. Henceforth, anytime you right-click your desktop or the background of a folder, you can launch the application with a single click.
Disable Notification Balloons
Few things are more annoying to experienced users than the balloon tips that pop up in the notification area on a freshly installed copy of Windows. Thankfully, they are easy to disable with a quick Registry hack.
Open the Registry Editor, navigate to the HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced folder, and highlight Advanced. You'll see a number of strings and DWORD values listed in the right Regedit pane. Right-click a blank part of the right pane; choose New, DWORD Value from the menu; and name it EnableBalloonTips. After creating the new DWORD value, highlight EnableBalloonTips, right-click it, choose Modify from the menu, and enter a value of 0 (the value will probably be set to 0 automatically). Close Regedit, restart your machine, and the balloon tips should be gone for good!
Have Disk Cleanup Delete (Virtually) All Files
By default, when you run a disk cleanup on a Windows 7 system, the operation will limit itself to deleting temporary files that are at least seven days old. Since there are few reasons to keep temp files for that long, however, let's look at how to arrange to delete any temp file that's at least one day old.
Open the Registry Editor and navigate to the HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files key. Click the Temporary Files key to highlight it, and in the right Regedit pane you'll see a DWORD value named LastAccess that has a value of 7 associated with it. Highlight LastAccess, right-click it, and choose Modify from the menu. In the edit window that opens, change the Value data to 1, and click OK. Exit Regedit, and you're done. After you've made that change, a disk cleanup will delete any temporary file that is more than one day old.
Add 'Take Ownership' to Right-Click Context Menu
Sooner or later you'll probably come across a file that you can't access for some reason, despite being logged in as an Administrator. In situations like this, taking ownership of the file or directory can help you gain access to the file, but the process is somewhat tedious. With some Registry editing, however, taking ownership of a file or directory is just a right-click away.
Instead of walking you through this process, though, we'll explain how to complete it in one fell swoop. First, select and copy all of the text listed below:
Windows Registry Editor Version 5.00
@="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" && icacls \"%1\" /grant administrators:F"
@="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
"IsolatedCommand"="cmd.exe /c takeown /f \"%1\" /r /d y && icacls \"%1\" /grant administrators:F /t"
Once you've copied all of that text, paste it into a new Notepad (or any basic text editor) document, and save the file with a *.reg extension; name it take-ownership.reg, for example. After saving the file, double-click it, follow the on-screen prompts, and add all of the keys to the Registry. Now you can right-click a file or folder and choose Take Ownership from the menu if you can't access or edit for some reason.
Congratulations, you're now a Windows 7 power user! If you find these Registry hacks useful, check out "9 Easy and Powerful Windows 7 Registry Tweaks" for more ways to customize the way your Windows 7 PC operates.