Click here to Skip to main content
14,298,693 members

Add a context menu to the Windows Explorer

Rate this:
4.63 (38 votes)
Please Sign up or sign in to vote.
4.63 (38 votes)
12 Apr 2005
Add a context menu to the Windows Explorer using Registry only.

Image 1

Image 2


Many of us like the convenience of the context menus in Windows Explorer and hate typing long paths in the command prompt window. This tool is going to address this issue by adding a new item on the context menu when you right click on a folder. You could get a command prompt that will open in the parent directory and not elsewhere. If you are not interested in the command prompt, then you can specify another executable of your choice as the target and still save some clicks and typing.


Dealing with Explorer usually requires some shell programming that is not always nice. Fortunately, the hack I'm going to describe would merely set some registry entries to make this happen.

Using the code

The registry entries are the following:

private const string MenuName = "Folder\\shell\\NewMenuOption";
private const string Command = "Folder\\shell\\NewMenuOption\\command";

The code is self-explanatory and it merely sets the registry:

private void btnAddMenu_Click(object sender, System.EventArgs e)
    RegistryKey regmenu = null;
    RegistryKey regcmd = null;
        regmenu = Registry.ClassesRoot.CreateSubKey(MenuName);
        if(regmenu != null)
        regcmd = Registry.ClassesRoot.CreateSubKey(Command);
        if(regcmd != null)
    catch(Exception ex)
        if(regmenu != null)
        if(regcmd != null)

Or it deletes the settings if you don't like them anymore:

private void btnRemoveMenu_Click(object sender, System.EventArgs e)
        RegistryKey reg = Registry.ClassesRoot.OpenSubKey(Command);
        if(reg != null)
        reg = Registry.ClassesRoot.OpenSubKey(MenuName);
        if(reg != null)
    catch(Exception ex)

The rest of the code only provides a sane user interface.

Points of Interest

You obviously have all the rights to change the Registry for this application to run as desired.


  • 12th April, 2005 - version


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Software Developer (Senior)
United States United States
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.

Comments and Discussions

Questionwhat to select in "Path to the executable or command" textbox Pin
yash15076-Sep-18 1:53
memberyash15076-Sep-18 1:53 
QuestionHow to make context menu entry dynamic? Pin
Nitin Sawant2-Dec-13 22:17
professionalNitin Sawant2-Dec-13 22:17 
QuestionSub Menu Pin
jeffingeorge26-Sep-13 1:35
memberjeffingeorge26-Sep-13 1:35 
QuestionRe: Sub Menu Pin
Marla Sukesh6-Oct-13 7:16
professional Marla Sukesh6-Oct-13 7:16 
GeneralMy vote of 4 Pin
Bharat Mallapur12-Jul-12 15:22
memberBharat Mallapur12-Jul-12 15:22 
QuestionExplorer context menu seperator Pin
Member 809151713-Feb-12 19:59
memberMember 809151713-Feb-12 19:59 
QuestionIcon Pin
JrrS885-Dec-11 19:38
memberJrrS885-Dec-11 19:38 
GeneralMy vote of 3 Pin
mohammadrefaie4-Nov-11 7:14
membermohammadrefaie4-Nov-11 7:14 
QuestionAdd a context menu to the Windows Explorer - Does not work for me Pin
subha@m9online30-Oct-11 22:08
membersubha@m9online30-Oct-11 22:08 
AnswerRe: Add a context menu to the Windows Explorer - Does not work for me Pin
John Mc Hale27-Jan-12 2:41
professionalJohn Mc Hale27-Jan-12 2:41 
Questionhow can have add a customize item to right click windows 7 like winrar program Pin
syasaketi19-Oct-11 19:34
membersyasaketi19-Oct-11 19:34 
AnswerRe: how can have add a customize item to right click windows 7 like winrar program Pin
dmihailescu20-Oct-11 12:53
memberdmihailescu20-Oct-11 12:53 
GeneralMy vote of 1 Pin
syasaketi19-Oct-11 19:32
membersyasaketi19-Oct-11 19:32 
QuestionGreat - but ... Pin
Wrangly4-Jul-11 21:08
memberWrangly4-Jul-11 21:08 
GeneralDrag Drop Pin
Onur Guzel15-Nov-10 4:10
memberOnur Guzel15-Nov-10 4:10 
GeneralRe: Drag Drop Pin
dmihailescu16-Nov-10 15:31
memberdmihailescu16-Nov-10 15:31 
GeneralRe: Drag Drop Pin
Onur Guzel19-Nov-10 8:58
memberOnur Guzel19-Nov-10 8:58 
QuestionCan we add SuBemnu Pin
Bassaammm12-Aug-10 2:21
memberBassaammm12-Aug-10 2:21 
Generalfor VB.Net Pin
phowarso13-May-10 20:01
memberphowarso13-May-10 20:01 
QuestionHow to retrieve the selected folder name? Pin
giji gangadharan17-Jan-10 19:42
membergiji gangadharan17-Jan-10 19:42 
AnswerRe: How to retrieve the selected folder name? Pin
Thomas Vogel26-Mar-10 6:11
memberThomas Vogel26-Mar-10 6:11 
GeneralRe: How to retrieve the selected folder name? Pin
Mostafa Elsadany25-Jan-11 8:25
memberMostafa Elsadany25-Jan-11 8:25 
GeneralRe: How to retrieve the selected folder name? Pin
Mostafa Elsadany25-Jan-11 8:36
memberMostafa Elsadany25-Jan-11 8:36 
QuestionHow can we link our exe file while right click the menu item Pin
giji gangadharan11-Jan-10 21:44
membergiji gangadharan11-Jan-10 21:44 
AnswerRe: How can we link our exe file while right click the menu item Pin
dmihailescu12-Jan-10 12:56
memberdmihailescu12-Jan-10 12:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Posted 12 Apr 2005


146 bookmarked