Customizing Right-Click
Menu Options in Windows

By John Fitzgibbon
Last updated: Tuesday, April 18, 2006, 11:33 AM PST





Introduction
This document gives step by step instructions for customizing the options that appear on the right-click menu for various file types. I have found this particularly useful for designing and testing web pages.

Typically, before uploading a HTML page, you will want to view it in both Netscape and Internet Explorer, and you may wish to make quick edits using, say, WordPad. To make this easier for myself I have added a "Netscape" and an "Edit" option to the right-click menu for all HTML files, (IE is my default browser). This means I can open HTML files in Internet Explorer, Netscape or WordPad with two clicks, instead of dragging files all over the desktop, or opening applications and doing a "File Open".

For GIFs and JPEGS, I have also added the Netscape option, and I've linked the "Edit" option to my favorite graphics editing program.

Warning
This document discusses editing the Windows Registry. This gives you complete control over the configuration of your menus, but you should be extremely careful not to change Registry values that are used by other applications. The author accepts no responsibility for any problems that may arise as a result of any changes to the Registry, even for those changes outlined in this example.


If you want to avoid modifying the registry directly, many of the changes described here can also be made in Windows Explorer's "Folder Options" menu. To use this approach, double click "My Computer", select the "Tools" menu, then "Folder Options", then the "File Types" tab. From here, you can highlight the file type you wish to change, then click the "Advanced" button to change the menu options that appear for the file type. This won't give you complete control of every option, but it is probably sufficient for most needs, and it is much less likely to cause problems as a result of accidental changes to the wrong registry keys.

Some Common Questions
Before tackling how to add menu options, here are a few interesting or common questions I've received.

Note: I stopped using Windows a few years ago, (I switched to Linux), so I'm afraid I no longer offer help with Windows Registry problems. Please accept this apology if I don't reply to Windows-related questions.

Question:
"How do I remove unwanted options that appear on right-click menus after installing software?"

Answer:
Usually, all that is required is to remove the appropriate key under the shellex\ContextMenuHandlers key in HKEY_CLASSES_ROOT for file type "*". For example:



In the sample shown, deleting "gvim" will remove the right-click options for the GUI Vim program I installed. I'd recommend making a back up of the key data in case you want to put it back in later. If you don't find the correct ContextMenuHandlers item under "*" you could try looking under specific file extensions. You could also try searching the registry for the text that appears on the menu. When searching, don't forget to preface any character that is underlined in the menu with an "&". The ampersand is typically used to identify the character to underline when a menu entry's text is saved in the registry.

Question:
"Can I add a 'Search' option to Internet Explorer's right-click menu?"

Answer:
I've written a script to do just that: http://www.jfitz.com/tips/search.htm

Question:
"Can I disable [insert menu option here] in Internet Explorer's right-click menu?"

Answer:
Non-standard items can be removed from the MenuExt registry key. This can usually be found here:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt

After removing the offending key, restart IE and the menu item should be gone.

With regard to the default behavior of Internet Explorer, (i.e. the menu items that don't appear in MenuExt) there are a number of restrictions you can place on newer versions of the browser.

One of the best online sources for information about the various options is at: http://registry.winguides.com/display.php/442/

You can't specifically disable a single menu item, (at least as far as I'm aware -- there may be some undocumented way around it), but you can make the menu go away completely. This might be useful for shared machines in a "public" environment, where changes made through the menu, (such as setting the computer's background from a web image), could be confusing to other users.

Navigate to:
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Internet Explorer\Restrictions

Set a DWORD value:
NoBrowserContextMenu = 1

You can also do this just for specific users if you wish. In this case, make the change under HKEY_CURRENT_USER.

If you export the modified key to a .REG file, (using regedit's export menu option), you can very quickly copy the change to a number of machines. (.REG files open using regedit when double clicked and apply the registry changes they contain. The files themselves are simply text files -- you can verify their contents in notepad or any other editor.)

Modifying the Right-Click Menu

Now on with the show...

  • First we need to find the location of the program we want to use
  • (Note: You can also get this information from the "Properties" box if you have a shortcut to the program on your desktop. Otherwise...)
  • Click on "Find Files or Folders" in the Start Menu
  • Search for the program you want to add to the right-click menu
  • Make a note of the folder where the program is found
  • Some common programs you might like to use are:
  • Netscape.exe - Netscape Communicator
  • IExplore.exe - Internet Explorer
  • WordPad.exe - WordPad
  • From the Start Menu select "Run"
  • Enter "regedit"
  • This runs the Registry Editor
  • Open the HKEY_CLASSES_ROOT "folder"
  • This opens a long list of file extensions, (.exe, .html, .ini, etc)
  • Following the extension list, extension groups are listed, ( for example "htmlfile" refers to all files with ".htm" and ".html" extensions, "jpegfile" refers to .jpg and .jpeg files, "giffile" refers to .png files)
  • Note: To find the extension group associated with a particular extension, click on the extension and note the value in the "Data" field, (on the right side), for the value named "(Default)"
  • Select the extension, or extension group you wish to modify - typically, you will want to modify an extension group, rather than an individual extension
  • In this example we want to add a "Netscape" option to all .html and .htm files, so we open the "htmlfile" extension group
  • Note: we could modify each extension separately if we wished
  • Right click on the "shell" option
  • Select "New"
  • Select "Key"
  • This creates a new key with a default name
  • Change the key name to whatever you wish to appear on the right click menu
  • Now right click on the new key
  • Select "New"
  • Select "Key"
  • This creates a "subkey" of the key we just created
  • Rename this subkey "command"
  • Note that in the right hand window the name "Default" and "value not set" appear
  • Double click on the "Default", (or the small "ab" icon to the left)
  • This brings up an Edit window which is used to set the default value
  • The "value" to enter is the name of the program to run
  • The format of the value field is:
  • FOLDERNAME\PROGRAMNAME "%1"
  • In this example its:
  • E:\Program Files\Netscape\Communicator\Program\Netscape.exe "%1"
  • Note: When we use the new menu option, "%1" is replaced with the name of the file we clicked on. This tells Netscape which file to open
  • Click "OK" to set the default value
  • This completes the process - Right clicking on any "htmlfile" will now have a "Netscape" option that opens the selected file in Netscape
  • You can add as many right click options as you wish
  • In this example, an "Edit" command has also been added which will open the file using WordPad
  • Note that the menu options are listed in the order in which they were created
  • The simplest way to reorder the options is to rename the option that you want to appear at the end of the list
  • To rename a menu option, right click on the key in the Registry Editor and select "Rename"
  • Rename the key to a temporary name, then rename it back to its original
  • In the above case, we renamed the "Netscape" option and it now appears below the "Edit" option
  • Note that you can remove the menu item by deleting the key in the Registry Editor
  • The "Delete" option is directly above the "Rename" option
  • Note that to delete the "Netscape" key, you must first delete its "command" subkey