(Please make sure you read all the pages linked under the Links section after you finish this article)Microsoft Windows Operating Systems starting from Windows 3.1. Before the registry was introduced, each application program used “ini” files to store their configuration. This was rather messy. Windows registry was first used only to store the OS core configurations only. Later this was changed and the application program configuration were also saved in Registry.
The first step in knowing the registry is of course seeing it. Registry is ordered hierarchically and consists of six main “hives” which get their names from API definitions :
HKEY_LOCAL_MACHINE (HKLM), HKEY_USERS (HKU)
each of these hives are further divided into sub-directories (sub-keys) in a hierarchical order. You can see these sub-keys when you click expand (+). These sub-keys contain other sub-keys and so on. This is shown in the above image.
Editing the registry
You can access registry by two methods, using RegEdit GUI tool or using “reg” command through Command Prompt. Since RegEdit method is easier, we will be discussing that method first. To open the graphical registry editor go to Start»RUN (WIN+R) , type “regedit” and press ENTER (You can find out more shortcuts in – Keyboard shortcuts for Windows). You can see the registry editor showing the two panes, one on the left showing a folder like structure (keys) and one on the right which will show the values saved in each key.
Using command prompt this process is not very straight forward. To open a command prompt, go to START»RUN (WIN+R), type cmd and press ENTER. In the command prompt type “reg /?“. ( Any command followed by /? will show a help for that particular command). You can start using command prompt for automating registry editing.
Since we have two tools built-in to edit registry, we can use both of them to take a backup as well. Easier one first.
Editing the registry can be tricky. If you change some value to the wrong ones, your OS may get configured wrongly and may not necessarily be recoverable (something of a joke, but still need to warn some poor souls). Having said that it should be obvious to you that taking a backup of your registry is the best way to prevent future disasters. So we will first learn how to take a backup of the registry, even before we have learned how to edit it!
Taking a backup
Taking a backup of the registry will produce a “.reg” file, which,when opened is capable of writing the values stored in it to the registry. One thing to know is that System Restore will also create a backup of the whole registry, but this is not directly accessible.
Here is the easy way. Go to registry editor “regedit” navigate tot he key you are about to edit (or not edit) and click on the KEY not not he value. You can either right click on the Key or Select File menu and then “Export”.
Select the option to backup either the selected key or the whole registry. Give a name to the backup file and save. A good practice would be to give a date based name and add a bit that allows you to remember what settings you changed. You can double click on this file and restore it anytime you want. Please make sure you take a backup or a restore point before any editing.
Since the easy way was fast, lets go to the slower and harder way. The command prompt command. reg command has got a command line switch which will allow you to take backup of the specified Key. the format is
reg export FULL_KEY_NAME FILE_NAME.reg
It is pretty useless to copy each and every available command options here. Microsoft has got a really good documentation on reg command. You can read abut Registry commands and advanced techniques in the Links section. If you have any doubts or issues, post a comment and I will get back to you soon.
There are some easy ways to revert to a previous setting if you get screwed up changing a setting. Like when editing important files, make a copy first, name it to something like older_VALUENAME under the same Key itself and name the new Value as the original one. If anything goes wrong you can just rename the backup and save the day.