Sponsored By

Sign in to follow this  
Chappy

How To Edit The Windows Registry

Recommended Posts

How to: Edit the Registry

Edited May 14/05 - New information added!

NOTE: After reviewing some notes I realized I had left out some information on backups and restoring. The new information is under "Backing up the Registry", subheading "Additional Information", and in "Restoring the Registry", subheading "Restoring using the Backup Utility"

Hi everyone!

This article is designed to be a refference guide to those who are not familiar with the Windows Registry but need to edit the registry for some reason.

About the Registry

The Windows Registry is something that many users do not even know exists and resides in a hidden area of the Operating System, and there is good reason for this.

The Registry holds all the information that your computer needs to bootup and to function properly. Making a mistake in the Registry can make your computer unstable or may cause it to not even boot, so knowing how to work inside the registry and be able to restore it if a mistake is made, is vital before any attempt to edit is made.

First thing to know is that the registry is unlike almost any other area of Windows or programs, most changes to the registry take effect IMMEDIATELY after you enter them. You are not prompted to "Save Changes" and there is no Undo feature either, so you must know what you're doing before you do it. The saving grace here is that the Registry can be Backed Up and restored if a mistake is made, and this is what we are going to look at today. The registry is so important, Windows makes a backup of it every time you start your computer.

Lets have a look at the structure of the Registry. To open the registry click the Start button and click on Run or press the Windows key + R to open the Run box. Now type in "regedit" or "regedit.exe" without the quotes and click OK.

This opens the Registry Editor and if you're familiar with the Folders View in Windows Explorer, it will look quite similar to you.

The registry is broken into five areas known as "Hives" and these hives have folders which are known as "keys". Each folder is a key which can contain more subkeys also known as "values", and they in turn can contain more keys. There are thousands of keys in the registry and each one controls an area of the computers operation or how your computer interacts with installed programs.

Click on the small "+" beside My Computer to expand it, you'll now see the five main hives underneath.

Navigating in the Registry

First we need to know how to Navigate to a specific area in the registry, lets say we need to go to:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce

Click on the + beside HKEY_CURRENT_USER to expand it, then scroll down to Software, Microsoft, Windows, CurrentVersion clicking the + at each one to expand them, and finally click on RunOnce to highlight it. You now have navigated to that key and all it's values will be shown in the right side pane...easy isn't it. As you can see it's almost exactly like navigating to a folder in Windows Explorer.

So, now you're ready to edit a key in the registry and you know how to find it, simple enough right? Well, yes it's simple to find it but now we need to change it and before we do that we have to make a backup in case something doesn't work right after the change.

Backing Up the Registry

Probably the easiest way to do this is by creating a Restore Point before we do anything else. If you're not familiar with doing this, please read my other tutorial on "Creating Restore Points in Windows"

Create a restore point and name it so that it's easy to remember if needed, but we are also going to create a backup of the key or hive that we are making the change to. Depending on the nature of the edit, we can either backup the entire registry or the main hive or just the key itself. If the change has implications to the entire system I prefer to backup the entire registry, but if it's just a program change or setting, just that hive or key will do.

For the entire registry highlight "My Computer" in the left pane, for a single key or hive just highlight it in the left pane, click File in the top menu bar or right click My Computer or highlighted key and select Export. A popup window will now open and you navigate to a place thats easy to remember where we can place the backup file, I prefer the desktop myself. When you decide where you want to keep it you now have to name the file you're exporting, name it something easy to remember that has to do with the edit you're making. Once you've named the file, click Save and then go to the place you saved it and make sure it's there. The file icon should look like a rubik's cube which identifies it as a registry file....you've just backed up your registry or key.

Additional Information

After going thru my notes I realized I left out some important things on backing up the registry. It's not information that would cause a problem if not followed, it's more to do with the ease of backing up using MicroSofts built-in Backup Utility.

MicroSoft has introduced a backup utility that uses a wizard interface for ease of use that works very well for backing up the registry and system state. The utility is automatically installed with XP Pro but must be installed from the XP CD with XP Home Edition.

Installing MS Backup Utility with XP Home Edition

Insert the XP CD into your CDROM drive and run it, it should autorun but if it doesn't just double click the icon in My Computer.

On the main menu of the CD, click "Browse this CD", then open the Value Add folder, open MSFT folder, open NTBACKUP folder, and double click the Ntbackup.msi file to run it. This will open a wizard that will install the Backup Utility on your computer.

Backup the Registry using the Backup Utility

Click Start > All Programs > Accessories > System Tools > Backup.

This opens a wizard which will guide you thru the backup process, we'll go thru it together here.

When the wizard opens make sure it's set to wizard mode and click Next. More Advanced users can switch to Advanced mode from here to customize exactly what is to be backed up.

Click "Backup files and folders" option and Next, the next page allows you to choose what to backup and as you can see it allows different options. For our use here today choose "Let me choose what to back up" and Next, click the + next to My Compter to expand it and put a check in "System State" and Next.

Here we choose where we want to save this backup, if it's just a few keys or a single hive we can use a floppy or any other directory you wish. After choosing the location and file name, click "Start Backup" and away we go.

Editing the Registry

Now we're ready to make the necessary edit to the key you need. There are different types of values to any key, String Value, Binary Value, DWORD Value, Multi-String Value, or Expandable String Value. For simple editing it's not necessary to know the differences between them for now, you should have all the information about the edit you're making from whatever site you found the edit on. To make the edit you simply change the key's value to whatever the new value will be and you're done. To change a value double click the proper entry in the right pane, this will open the value editor where you can now change the value desired.

Remeber, once you close the value editor that change takes place and there's no turning back...double check that you've made the right edit to the right key before you hit OK. If you're unsure just close the value editor using the red X or Cancel

Restoring the Registry

Well, here we are....you messed up and now you need to restore your computer, or the desired effect wasn't achieved and you want to return things to the way they were. There are three scenarios here, either your machine is unbootable, boots but is unstable or you can boot to a stable machine but just want to restore the original value. Lets look at the worst first..

Unbootable computer

Here is where you'll be glad that Windows saves a copy of the last good registry every time it shuts down. If your computer will not boot, you should see a boot option screen with Safe Mode options and one called "Last known good configuration", this is what you want. Select the Last known configuration option and hit ENTER, your machine should bootup now.

Unstable computer

Well, the machine works but it's buggy and doesn't work quite right. You have a couple of options here, you can use System Restore to restore your computer to the point before you made the changes or you can merge the saved backup file back into the registry.

To use System Restore simply open the applet and select the restore point you want and hit Restore. If you're unsure how to do this properly, please read my tutorial on "How to use System Restore", due out real soon.

To merge the backup registry file back into the registry, navigate to the directory that you saved the file into (this is why I use desktop) and double click the file. You'll be asked if you wish to mrege this file into the registry, select Yes and it's done.

Stable but undesired effect

Here again you can go to your backup file and double click it to re-merge it into the registry, or you can do the manual route and go to the key in the registry and change it back to it's original value. I don't recommend this method for anything but a simple value such as changing a 1 to a 0, or something like that. Binary values and CLSID's are far too complicated to try a manual edit.

I always keep the backup file on the desktop for about 2 - 3 weeks to be sure there are no undesirable effects. If after this time there is no instability and all things are functioning normally, it's safe to delete the file.

Restoring using the Backup Utility

Open the Backup utility and on the second screen choose "Restore files and Folders". Follow the onscreen prompts from there to restore the backup files.

NOTE: If you use Backup in Windows XP Home Edition, Automated System Recovery (ASR) is not a supported feature. You can use the current version of Windows XP Home Edition to start the configuration process for ASR, but you cannot complete the process.

Ok we're done for now but if for some unknown reason you've made a mistake and your machine will not boot and you cannot restore it using the "Last Known Good Configuration", thats when you find a computer to use and come to the boards for help. There may be a way to get you going again, then again maybe not but we'll try. It's very rare actually to have simple regedits make a machine completely unbootable so don't be afraid to learn how to work inside the registry, it can be a very handy skill to have.

Thanks for your time!

Share this post


Link to post
Share on other sites

Well, now that you know how to edit the registry and you've worked up the courage to give it a try, lets make a change that I know you'll like so you can get some first hand experience inside the registry.

In the Windows Tips & Tricks forum, I posted an article on how to add two values to your right-click context menu, "Copy To" and "Move To". These options will enable you to simply right-click an object, select either option, and move it or copy it to another location just like that.

I'm now going to walk you thru how to make these changes so you can see how easy it is to work inside the registry!! These items are additions to the registry and not an edit to an existing key so you'll also be learning something new here today, but it will give you some experience and confidence for the next time you need to do something in here.

Alright...lets get to it.

Whats the first thing we do?

Right...back up the registry and create a Restore Point.

Since we are adding new keys and not editing existing ones, some would say that a backup really isn't required here, but we'll do one anyway.

Right click the hive "HKEY_CLASSES_ROOT" and select Export, open the drop down in the window that opens and select the Desktop. Now name the file "Copy and Move to" and click EXPORT, then navigate to the desktop to ensure the file is there.

1) Open the registry and navigate to "HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers" and expand the ContextMenuHandlers key.

2) Right click on ContextMenuHandlers in the left pane and select New > key, name this key "Copy to" without the quotes and hit ENTER. You have now created a new registry key...aren't you proud of yourself?? I sure am!

3) Assign the value to this key by double clicking the "Default" in the right pane to open the value editor. Copy and paste this into the value data box: {C2FBB630-2971-11d1-A18C-00C04FD75D13} and hit OK. You'll now see the value change in the right pane to the selected text.

4) Right click the ContextMenuHandlers key once more and make another new key, name this one to "Move to" and hit ENTER. Open the value editor again for this new key's value: {C2FBB631-2971-11d1-A18C-00C04FD75D13}

You're done in this area now so scroll up and collapse the keys back up as you go, we don't want a messy registry now do we...

Go all the way back up to the very top just under My Computer but still in the HKEY_CLASSES_ROOT hive. You'll see a small key simply called *. This is where we go next..

1) Expand * and navigate to HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers, expanding the key once more like we did before.

2) Create a new key in this section same as above and name it "Copy to", and set it's value to {C2FBB630-2971-11d1-A18C-00C04FD75D13}

3) Create another key called "Move to" and set it's value to {C2FBB631-2971-11d1-A18C-00C04FD75D13}

Collapse the key and exit the registry.

There we have it, feel free to immediately try this one out as I'm sure you'll love it as much as I do!!

Thanks for your time!!

Disclaimer:

Use at your own risk! I have tested this one out many times and have found it to be safe in all the installs I have made.

I do not however, claim any responsibility for problems you may experience.

Share this post


Link to post
Share on other sites
Sign in to follow this