In “Troubleshooting Windows file associations, part 1,” I explained some methods you can use to troubleshoot and repair registered file extensions that have been hijacked by other programs. As I explained in part 1, the Windows Explorer tools you used are actually nothing more than a GUI interface that allows you to painlessly and safely make changes to the registry. However, you can actually gain much more control over the entire process if you make the changes directly through the registry rather than through the GUI interface. In this Daily Drill Down, I’ll highlight the sections of the registry that are responsible for holding information on registered file extensions.
Before I get started, I should mention that working with the registry could be dangerous. Making a mistake within the registry can destroy or disable Windows and/or your applications. Therefore, before making any changes to the registry, be sure that you have a good backup of your entire system. Also, if you have any doubt as to your ability to work with the registry, you should stick to using the process that I explained in part 1. Now, if you’re still with me, let’s get started.
The Registry Editor
The primary tool for making changes to the Windows registry is the Registry Editor. As you might have noticed, there’s no icon or menu choice for the Registry Editor. This is because Microsoft didn’t want Windows users to accidentally stumble onto the Registry Editor and start making changes to the registry. Because no icon exists, you’ll have to access the Registry Editor via the command line. To do so, click the Start button and select Run from the Start menu. When you see the Run prompt, enter regedit and click OK. When you do, Windows 98 will open the Registry Editor.

Before I get begin explaining the process of repairing registered file extensions, let’s take a brief look at the Registry Editor. As you can see in Figure A, the Registry Editor is divided into two main sections. The section to the left functions in a manner similar to Windows Explorer. It allows you to navigate through the Registry key by clicking the plus and minus signs next to each key. As you can see in Figure A, there are six primary keys beneath My Computer. Every other registry location is found beneath one of these six keys.

Figure A
The Registry Editor is the primary tool for making changes to the Windows registry.

The right pane contains the actual registry information. If you select any lower level registry key, you’ll see information appear in the left pane of the Registry Editor. This information is divided into two parts:

  • The key’s name
  • The key’s data (sometimes referred to as the key’s value)

Because the process of correcting registered file extensions involves creating new keys and editing existing keys, you’ll need to know how to work with the Registry Editor.

To create a new registry key, navigate to the desired location within the registry tree structure and select the New | Key command from the Edit menu. When you do, you’ll see a new key appear beneath the key you’ve selected. The key will be named New Key #1, but it will be in rename mode, so you can type the desired key name over top of the existing key name.

To erase a registry key, select the desired key and press Delete. When you do, you’ll see a prompt asking if you really want to delete the key. Click the Yes button, and the key will be deleted. Keep in mind that the Registry Editor doesn’t have a save function.

Any changes that you make to the registry are saved instantly. Therefore, be absolutely certain that you have the correct key selected before pressing Delete. If you accidentally delete the wrong key, the only ways of getting them back are by manually re-creating them or restoring from backup.

Finally, to modify an existing key, select the key from the right side of the screen and right-click on the key. When you do, you’ll see a context menu that corresponds to the key. You can use the Rename command to change the key’s name, and the Modify command lets you change the key’s value.

Working with file extensions
Now that you know a little about how the Registry Editor works, it’s time to get started with correcting that troublesome file extension. When tracking down a file extension problem, the first place you need to go is to the HKEY_CLASSES_ROOT section.

As you can see in Figure B, this section lists every registered file extension in alphabetical order. Once you’ve located the file extension you want to work with, select it. To the right of the file extension, you should see a key or two that describes the file extension’s function, as shown in Figure C.

Figure B
The HKEY_CLASSES_ROOT key contains a reference to every registered file extension.

Figure C
Write down the name of the alphanumeric key beneath the ShellEx key.

Depending on the key you’re working with, there may also be a plus sign next to the key. If you click the plus sign, the registry tree will expand to reveal a key named ShellEx. Beneath the ShellEx key, you’ll see a key that has a subkey with a really long alphanumeric name. You can see this subkey in Figure C. Be sure to write down this key’s name, because you’ll need to know it later on.

Hopefully, you’ve been able to get the alphanumeric number that I mentioned earlier from the ShellEx section of the file extension’s registry key. If you have this key, you can insert it into the Edit menu’s Find function and use the key to search for other sections in the registry that correspond to the program or the registered file extension. If you don’t have this ID number, though, it’s no problem—you can perform the process manually.

To do so, scroll through the HKEY_CLASSES_ROOT section until the list of file extensions ends. Below the file extensions section, you’ll see a list of registered programs. Now, locate the program that owns the extension that you want to work with. Beneath the program will be a subkey called CLSID. This subkey will contain an object called Default, whose value will be an alphanumeric key. Write down the value of this key.

Now that you have the alphanumeric key, it’s time to put it to work for you. In the same section, you’ll usually find several other keys beneath the program you’ve selected. One of the subkeys is called Extensions. This key contains other subkeys that reference the file extensions that are registered to the program. Each of the registered extensions has a unique identification number. If you need to move the extension from the current program to a different program, you must write down this registration number.

When you add the extension to another program, you must manually add the extension name and this identification number beneath the program’s Extensions registry key. If you want to simply disassociate the extension, just delete it from beneath the Extensions section. You can see a sample of the Extensions section in Figure D.

Figure D
The Extensions section contains a list of the extensions that are registered to each program.

As you may recall, I mentioned that a program listing usually has these sections. If you find your program listed but it has no CLSID or Extensions section, the program may actually be listed under several different names. Only one of the names will contain the necessary information. If this happens to you, you can either browse the list manually or use the Edit menu’s Find command to search for the file extension.

Another section of the registry you should know about is also contained beneath the program’s registry key. It’s called Shell. As you can see in Figure E, the Shell section contains a listing of the choices that appear on the context menu whenever you right-click on a file with the given extension. For example, in Figure E, we’re looking at an AVI file. In this case, the context menu commands are Open and Play.

Figure E
Each program’s Shell section contains the commands that appear on the context menu for any file extensions that the given program has registered.

Beneath each context menu command is a subkey called Command. This subkey contains the actual executable command that the context menu uses when you make a selection. For example, if you right-click on an AVI file and select the Play command from the resulting context menu, Windows will execute the command C:\Program Files\Windows Media Player\mplayer2.exe /play %L, because of the command contained in the registry, as shown in Figure E. Once you understand how the Shell section works, you can add or remove context menu commands freely.

If you do decide to manipulate context menu commands, though, just remember two important things. First, any time that you make a change, it affects any file with an extension type that’s registered with the given program. For example, if you make a change to an AVI file, the change will also affect AU files and WAV files, because all three types of files are registered to the Windows Media Player (at least that’s the case on my computer; yours may be different). Second, remember that not all programs use the simple batch file style context menu commands. Some use OLE commands instead. Unless you truly understand the intricacies of object linking and embedding, it’s probably a good idea to stay away from these commands.

In this Daily Drill Down, I’ve explained how you can correct problems with registered file extensions by making changes to the Windows registry. As you work through this Daily Drill Down, please remember that making a mistake within the registry can destroy Windows and/or your applications. Therefore, make sure you have a good backup of your entire system before attempting any of the procedures that I’ve discussed here.

Talainia Posey learned to handle PCs the old-fashioned way: by reading manuals and doing on-the-job troubleshooting. Her experience also includes installing networks for several small companies. When she’s not working on computers, Talainia loves to shop for toys and watch cartoons, or spend time with her cat, Beavis.

The authors and editors have taken care in preparation of the content contained herein but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for any damages. Always have a verified backup before making any changes.