SEARCH

How-To Geek

Add "Open with Notepad" to the Context Menu for All Files

The default method of opening unknown files forces you to go through a list of known applications and is generally a pain to deal with. That’s why I like to have a context menu option for “Open with Notepad” so that I can quickly open up files without having to go through a lot of trouble.

This registry hack is nothing new, it’s been around forever… think of this as a refresher course. Also note that you can use this same technique to substitute any other application that you’d like by adjusting the path in the registry to point to the different editor.

image

Manual Registry Hack

Open regedit.exe through the start menu search or run box, and then browse down to the following key:

HKEY_CLASSES_ROOT\*\shell

image

Right-click on “shell” and choose to create a new key, calling it “Open with Notepad”. Create a new key below that one called “command”. Double-click on the (Default) value in the right-hand pane and enter in the following:

notepad.exe %1

The change should take effect immediately… just right-click on any file and you’ll see the next menu entry.

Download Registry Hack

Just download, extract and double-click on the OpenWithNotepad.reg file to enter the information into the registry. There’s also an uninstall script included.

Download OpenWithNotepad registry hack

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 02/4/08

Comments (90)

  1. darkhelmet

    Hehe…why you want to use that hack of a text editor anyway :P
    Grab Notepad++, and then just tell it to open everything :D

  2. The Geek

    Totally agree… you can see in the screenshot that I use UltraEdit =)

    I’m sure this will still be useful for somebody though, if only to show how to do it.

  3. Gene Thomas

    Or, you could download the notepad replacement, notepad++. Its installation offers the option of adding it to the context menu.

  4. nants

    Um. What am I missing? Why the registry hack? Simpler to add a shortcut to one’s SendTo folder, yes?

    1. Open C:\Documents and Settings\MyLoginName\SendTo folder
    2. Right-click, choose “New shortcut”
    3. Type in Notepad.exe (no path needed)

    Voilà!

  5. The Geek

    @nants

    You are absolutely correct, that method works perfectly… however I’ve always found the SendTo to be much slower than this method. Perhaps I should look into that…

    Note that you could also create a notepad shortcut in quick launch or desktop and drag and drop the file onto it.

  6. nants

    The Geek, Interesting to note about speed. I like SendTo because it’s not beyond any capable user, and it’s useful for many things. I’ve added shortcuts to register and unregister DLLs, for example. In any case, I appreciate the extra registry tidbit. Thanks.

  7. Jordan

    Does anyone know if this works for Vista?

    As for those who prefer an alternate editor, (I’m a huge fan of EditPad lite) I’m sure this will work for you with an alternate file system path.

  8. dner

    Did not work from HKEY_CLASSES_ROOT\*\shell…

    Did work from HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell

    Same instructions

  9. dner

    Also note that changing the value for Default for the Open with Notepad key changes the text that appears in the context menu.

  10. jorsch

    What about adding separators to the items on the Context list? I have been searching for a way to do that forever and have not been successful.

  11. EnOne

    This seems like a good way to add to the context menu. How do you remove items from the context menu. WinZip and McAfee come to mind.

  12. The Geek

    @EnOne

    With WinZip you can go into the configuration settings and turn off those context menu entries. This works for most well-behaved software as well.

    For McAfee, it’s a little more of a pain… Usually you can find their entries in a similar registry spot, but you might have to use ShellExView or one of those tools to remove the shell extension. I need to look into this, would make a great article topic.

  13. The Geek

    @Jordan

    This does work for Vista… the screenshots are from my Vista machine, in fact =)

    @jorsch

    That’s a really good question, something I’ve wanted for a long time but haven’t found a solution. I’m pretty sure you’d need a third-party shell extension, but I suppose there’s a possibility there’s a registry hack for it.

  14. Johnboy

    @EnOne
    h**p://www.hace.us-inc.com/mmm.shtml

    There is a free & pay version…for XP only.

    This is an elegant solution, I’ve used it for years.

  15. Mario Grgic

    Why bother with all this. Why not just add a shortcut to notepad.exe in “Send To” folder. Then just right click on any file and send it to notepad, effectively opening the file in notepad.

    While you are at it download Notepad++ (a better notepad), or if you are a programmer, learn VIM (it will pay dividends for the rest of your life).

  16. jd2066

    Nice tip.
    Oddly enough the idea of adding notepad* to the context menu in Windows didn’t occur to me before even though I use it all the time.
    Also I found adding the command to the HKCR\AllFilesystemObjects key instead of HKCR\* worked better on my computer as it appears the * key also adds the menu item to special folders like Computer and Network.

    * That would be metapad for my computer and notepad for other ones I use.

  17. The Geek

    @jd2066

    Are you on Windows XP? On my Windows Vista box I don’t see that.

  18. jd2066

    I’m using Windows Vista. I guess something must be broken on my install as a quick search online shows the HKCR\* key is suppose to to be files only and not folders.

  19. jd2066

    It also appears using this tip with AllFilesystemObjects will make all folders in explorer open with notepad.
    I guess I’ll just stick with * and hope that the notepad entry displaying on folders is a bug that will be patched.

  20. jd2066

    I just did it with the * key and everything works.
    I think what happened was I made the mistake of thinking that since PowerCMD used that key and displayed for special folders that it meant I would have this problem with notepad too and didn’t even try the * key. I think PowerCMD must be using another key to display on folders.
    Sorry about the waste of comment space. I would delete my extra posts and the part in my first post about the AllFilesystemObjects if I could.

  21. Michael

    Worked okay on my computer (XP) and my laptop (Vista). Thanks for your advise!

  22. B

    you guys need to go out more often…

  23. TJ

    You might want to quote the %1 -> “%1″ The Open With.. didn’t work with paths with spaces in it without it.

  24. Johny

    Has any one gotten this to work with XP?

  25. Johny

    Never mind. I got it to work. In XP the shell key does not already exist under *. So I had to first create the key:

    HKEY_CLASSES_ROOT\*\shell

    Everything else worked the same way. Thanks a lot.

  26. Johny

    I was hoping to use this to “send” multiple files at once to a program for processing. Unfortunately, when attempting to send more than one file, it makes a different call to the application for each file, resulting in several instances of the program.

    I don’t know if I am explaining this well. I want to be able to send several files to a single instance of a program, like you can do with Winzip for example. I have a feeling that this is a lot more involved, but if any one know of a simple way to do this I would be very appreciative.

  27. jd2066

    You can try using the Program Fast Explorer at http://thesoftpro.tripod.com/downloads/fe/
    Under Vista you need to run it’s configuration program as an Administrator. I just tested it and it crashed saving settings when I didn’t do that.
    Just go to the “Submenu Items” tab and add your program. Despite it’s name you don’t have to put the item under a submenu, just click click Item and Add item.
    That tab configures entries with it’s shell extension that will launch programs how you want. Unfortunately, since that uses the command line there is a length limit for it. For one path I used with it the max files I could use it to open was about 50 I think.

  28. Johny

    Thanks for the tip. But, from your description it sounds like there may be no advantage to just using the plain old “Send to” method. It is also limited to a certain number of characters it can send. So if there are a lot of file, or if the path to the files is deep, it complains with some bogus message about not being able to access the files. But, thanks any way. Fortunately in Linux I don’t have that problem with KDE Service Menus (the “Send to” equivalent ;).

  29. jd2066

    Well there is the advantage of launching a program with the selected files instead of one application instance for each file. It just has a limit due to the command line limit.
    I think the KDE Service Menus also use the command line for this.
    It just works better because a longer command line length limit.
    If I understand right the max command line is 8191 characters in Windows and in Linux it is 131072 characters.
    Those programs may have a shorter limit though.
    I’ll have write some test scripts to see if the limits are correct.

    Info from:
    http://support.microsoft.com/kb/830473/en-us
    http://www.in-ulm.de/~mascheck/various/argmax/

  30. Johny

    Wow, big difference between 131K and 8K. Thanks for the info.

  31. jd2066

    Ok. I just did some tests.
    With some test commands on Linux with bash it appears the number I found is correct.
    With a test script on Windows Vista with Fast Explorer I got a max command line of 32733 characters and with that I could send about 266 files to my test script.
    So what I listed of 8191 characters above only applied to commands typed in the command prompt.
    When I could only send 50 files before I had an older version of Fast Explorer and used Windows XP.
    One of them had a lower limit I guess.
    So the difference is actually about 131K and 32K.
    Still quite a difference in command line limits between Windows and Linux.

  32. GoodBytes

    This is cool, but I wonder how to add an icon next to the item i the context menu, like in PowerArchiver, you have icons of the program on each of its item. Is it possible, or is some super complicated windows hack?

  33. jd2066

    You can try Fast Explorer (link in above post).
    You can add items with an icon beside just like those archive programs do when you use it’s “Submenu Items” tab (Badly named though as it’s not just for submenus). It’s static items tab just uses the registry like this article lists.

  34. GoodBytes

    Well I ask to know how to do it manually, as I am making a small software, and I would like to have the icons next to my context menu items.

  35. jd2066

    In that case you would need to write a context menu handler that displays the item with an icon.
    There are some tutorials online on how to write them.
    One such tutorial is at http://www.codeproject.com/KB/shell/shellextguide2.aspx

  36. Gene Thomas

    You might try abiword instead of notepad, or notepad++. It is a free, fairly complete, but very compact word processor that loads very quickly due to its compactness. On a new, fast machine such as mine, it loads very fast.

  37. GoodBytes

    Thanks, jd2066

  38. Matthew Delisle

    I made a little program if you don’t like messing the registry.

    http://mattdelisle.net/?p=6

  39. Floroskop

    Hello!
    I think this try.

  40. abhishek

    adding entry for the notepad is good…but i would prefer notepad++ which automatically adds an entry in the right click menu.

  41. Michael

    Works on all operating systems, including Windows 95, NT, 98, 2000, Millennium Edition, XP, Server 2003 and Vista. Except for Windows 3.xx.

  42. vamsi

    hi every one.I did the above code.i am happy.now i have a doubt about that code can any one tell me the process of renaming the explore and open items in the contextmenu.

  43. Leo

    I’m using XP and it has note pad in accessories but I can’t get it to open after I click on it in order to create my web page? Suggestions to make this happen would be greatly appreciated. If not doable how else do you suggest getting a word pad to work for HTML/web page endeavor?
    I’m not a computer geek and need spelled out help in getting a word pad or alternative procedure to enable me to proceed. Thanx. Leo

  44. mahesh

    adding open with notepad command is fine….but how do i remove tis option…i just wanted to know….plzz help

  45. vamsi

    hi Mr.Mahesh do the same in reverse means,just remove the key which you already created in the shell .

  46. truckdriver

    What would be an easy way to access the run.exe through notepad as a limit user from Windows Server 2003? I have got notepad even though it is not on the list of programs that I can generally access. Should I just save as a bat. file so I can use cmd?

  47. j

    Hello to The Geek.

    GREAT Job!

    I had this on my old win2k install, like from 4 yrs ago, but I didn’t remember how, so I couldn’t RE:DO it.

    Thanks a ton, you’re the greatest.

    j

  48. Doug

    How to you change the “(Default)” value. I’m not getting the option, it is grayed out. My right click menu displays notepad.exe %1. It works fine but I was just wanting some form to go with my function.

  49. bogdanp9

    I used Notepad++ and Notepad2 for some time. I decided to stick to Notepad2, but couldn’t find the “Edit with Notepad” button in the right-click menu. Your registry hack saved me some trouble. Thanks

  50. xInToxiic

    Any Idea Why This When Applied To WinRAR It doesnt Work?

    Cause I Hide My Files In JPEG’s :)
    and its getting annoying having to go throught all thoose menus! :(

  51. dave

    I too have used this registry hack for ages – with a link to TextPad. I prefer it to Send To, as it is less dragging and clicking, and it is something I use ALL THE TIME.

    Vista’s implementation is annoying: when selecting multiple files, the TextPad item does not appear unless all the files are the same extension. For example, I would like to open both the source.cpp and source.h files at the same time in a single TextPad. Vista forces me to select them separately. And I don’t really want to change the default for those files away from the Visual Studio defaults.

  52. Robert Zero

    If by the way you wanted to put an 16×16 icon before the “Open With Notepad” line, how would you do that, if possible of course?
    My friend here says it’s impossible… any clue?

    Robert Zero

  53. nakul

    doesnt seem to work in windows 7, only thing under shell is removeproperties.

  54. champloo

    interesting. this is was great since notepad++ doesn’t add it automattically on win7.
    do you know how to add an icon to the entry?

  55. Chon

    I have been looking for this for years! And this is such and easy solution too! I love it!

  56. Andy

    To add ‘Open with Notepad++’ to Context Menu add following values to registery ( simply create RegistryUpdate.reg file and paste ):

    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\*\shell\Open with Notepad++]

    [HKEY_CLASSES_ROOT\*\shell\Open with Notepad++\command]
    @=”C:\Program Files\Notepad++\notepad++.exe %1″

  57. David Hesselbom

    Andy’s solution didn’t work for me. I removed the quotation, @ and = marks, leaving

    C:\Program Files\Notepad++\notepad++.exe %1

    in the key data field. Now it works. To add an icon to the menu, open the registry editor again, and go to the key named Open with Notepad++ (not command). Here, create a new String Value and name it Icon. Set its data to

    C:\Program Files\Notepad++\notepad++.exe,0

    That should do it. Try setting the number 0 to something else if you want. Setting it to 1 gives you a little green chameleon. I don’t know how high you can go but creating a shortcut to the exe and browsing for icons for it shows there’s a lot of icons in notepad++.exe, most of which don’t fit the program at all :)

  58. Dinesh

    Hi admin

    I need a similar thing that should be in a common right click menu says “Open Notepad” if i click that it should open a blank notepad.

    Can you help me?

  59. Eric

    @Andy
    @David Hesselbom

    Thanks so much for this info! I was quite distraught after I installed Notepad++ on my new Windows 7 machine and there was no right-click menu option as there has been for years. Your suggestions remedied the problem!

    Thank you!
    Eric

  60. Matt

    I have Windows 7 and an error appears when I try 2 make a new key in regedit, saying u don’t have permission. How can I get around this? And do like the instructions above.

  61. JC

    Very Useful.Saved me an extra click by avoiding a trip to send to menu.
    Thanks a lot.
    Jerome.

  62. James Durning

    Was looking for a way to add this only to particular file types; seems to be harder on Windows 7. They’ve taken away all the old configuration menus, grrr!

  63. mt

    can I use HKEY_CLASSES_ROOT\drive\shell for this command or do I have to use HKEY_CLASSES_ROOT\*\shell?
    By the way your tweaks are amazing so far they all work

  64. Muhammad Shaikh Arif Ahmed

    Thanks a lot Bro, i was thinking of something like this.
    thanks a lot.
    G.bye

  65. peter

    Hi
    I need to know the file/folder path copied to a .net app when i right click it in windows the explorer, help!

  66. Hardik

    Thanks. Helpful details.

  67. LP

    Worked perfectly, thank you!

  68. John J

    Nice type about adding Notepad to the context menu. I always wonder how to add contect menu. Thanks.

  69. Stefan

    I really like this hack, before I used to put a lnk-file in my SendTo but it is sometimes very slow that way and less convenient. Also Vista doesn’t allow me access to my own SendTo anymore, I have to open cmd.exe as Administrator and type the copy command and filename (of the lnk-file or other executable).
    (So nants, Mario Grgic (even though it was already answered b4) Johny, this is why)

    As I am the only user in the company who would use this, I tried another registry-entry, in HKEY_CURRENT_USER where, in Vista sp2 there also is a key \Software\Classes key. Adding the keys *\shell\Open with Notepad\Command and modifying stringvalue ‘default’ to notepad.exe “%1″ there works on my machine and shouldn’t interfere with other users.

    I am going to try if this also works on W2K (on my home-PC, still the best), and if possible on Vista sp0 (updates disables hardware on the 2008 Acer notebook), XP and Win7.

    I also made a vbscript CopyHere.vbs (which lets me enter the new filename in an inputbox) which I can run the same way, copying up to 9 files. It leads too far to also put the code for the script here, also because of it’s lenght.

    [HKEY_CURRENT_USER\Software\Classes\*\shell\CopyHere (typ new name)\Command]
    @=”wscript.exe C:\\Users\\Public\\CopyHere.vbs \”%1\” \”%2\” \”%3\” \”%4\” \”%5\” \”%6\” \”%7\” \”%8\” \”%9\””

  70. Nick

    Thanks this is gonna be very useful! :)

    I just got done recovering my pc, it had some, minor problems.
    I searched for how to changed the favorite links, and well long story short, I’m gonna be checking out for this stuff more often! Bookmarked.

  71. npi

    Thanks. This makes Windows 7 more useful. Every time I find missing windows xp functionality in windows 7 feel like downgrading to Windows xp 64.

    Quick launch toolbar gone.
    no more “open with…” for unassociated file types
    can’t unassociate or remove an associated file type

  72. Jim Hunt

    So why does this work for notepad, and not for wordpad.
    Wordpad is better for Unix files, without doing unix2dos first.
    But Open with Wordpad (identical to notepad registry section)
    doesn’t work like notepad does. I did notepad by your zip,
    and wordpad by hand, but they look the same in regedit.

  73. Aj

    Thanks dude,I associated all my files with my fav Hex editor!

  74. Dominic

    This does not work for me with Microsoft Office files (DOC, DOCX, XLS, XLSX). It works with others but if you right-click on these ones you don’t see this option. Anyone know a way around this?

  75. Raghad

    What does the %1 represent in ( notepad.exe % 1 ) ?? why we need to write it ?
    Thanks .

  76. gary walia

    csn tours is a tours and travel as well as medical tourism promoters from usa,we have branches in india also .our major packages are religious tours .

  77. ashley

    can someone help with windows 7 plz its hard to understand boys when ur a girl

  78. Gulumba

    PLEASE someone help me! I couldn’t find shell, only shell explorer,shell autoplay, etc…

  79. Hikari

    Thanks A LOT!

    I was trying to make Notepad++ context menu link work in XP64, and your solution is MUCH easier!

  80. Alex

    How do you put an icon next to the “Open with Notepad” link?

  81. Harry

    I want to use the same trick to execute a VBScript in a public, networked location.
    The script is not on my local machine, but in a network location.
    Can I do this using this technique?

  82. Steve

    I assume that the %1 is a place holder for the fully-qualified filename. How would I specify multiple selected files, such as two files that I want to both be passed to a program like WinMerge?

  83. Mik

    The article needs to be updated for Windows 7 Home Premium, SP1.

  84. Mik

    Never mind my previous post, I simply overlooked the asterisk \*\ in the directory!

    Thus, scrolling further down the HKEY_CLASSES_ROOT, I saw several (16) entries for “shell”, starting with “Shell.Application” and ending with “ShellNameSpace.ShellNameSpace.1″

    I just thought the asterisk was a wild card symbol, and even didn’t notice the proper structure in the screenshot image. My mistake!

  85. rex

    Hi …
    i’ve got a problem here and need some help… i’m not a comp geek huhuh…

    i’ve change my “thumb.db” folder “open with notepad”..
    every each of the same folder seems to change also… some of my
    software and games did not work properly… how can i change this folder to “unknown application”
    back……

    somebody HELP ME please… ;-(

  86. alex

    u rock bro.. thanx a lot… :-)

  87. Behzad

    That is very good!! thanks

  88. Tony

    Hello,
    the registry that I’ve download to remove the context menu dont works.
    any help please

    >OS Win7

  89. Tony

    sorry, fixed because I0ve change the name “Open With Notepad” with other, any suggestion how to modify the voice in context menu “Edit with Notepad++”?

    Thanks

  90. v1ncent

    I’m looking for a way to tell Win7 x64 to open all files with Notetab Light automatically. Any registry codes supplied will meet with a hearty thank you.

Enter Your Email Here to Get Access for Free:

Go check your email!