13

I think that the title says it all.

I use the portable version of Notepad++ and would like to have a menu on the Windows 10 right click context menu which allows me to edit files with it.

4
  • 2
    Not a method to accomplish this but, would adding a shortcut to the exe into your "Send To" list work for you?
    – Dimblefeck
    Oct 21, 2016 at 9:37
  • Yes it would (+1) Oct 21, 2016 at 9:38
  • 1
    Cool! Let me know if you want me to make that an answer. Are you familiar with getting to the Send To folder to add the shortcut?
    – Dimblefeck
    Oct 21, 2016 at 9:42
  • Feel free to post an answer, with enough info to help others Oct 21, 2016 at 9:45

6 Answers 6

6

This is explained in How to Add Any Application to the Windows Desktop Right-Click Menu article which says:

The first thing you’ll want to do is open up regedit.exe through the Start Menu search or run box, and then browse down to the following key: HKEY_CLASSES_ROOT\Directory\Background\shell Registry Editor

The screen should look similar to this one if you are in the right place.

Next, you’ll want to create a new key underneath the shell key, the name of which is exactly what is going to show up on the desktop menu. Right-click on the “shell” key, and then choose New \ Key from the menu.

Give the new key the name that you want to show up on the desktop context menu. For this example we’ll be using Open with Notepad++.

Next you’ll need to create the command key that will actually hold the command used to launch the application. Right-click on the new Notepad++ key, and then choose New \ Key from the menu.

Registry Editor

Give this key the name “command” in lowercase.

To complete this step you’ll need the full path to the application that you want to launch. You can use Shift + Right-Click to get the Copy as Path menu item to find this more quickly.

Now click on “command” on the left side, and then double-click on the (Default) key in the right side to edit the string value.

Paste in the full path to the executable that you got from the “Copy as Path” step above, or you can put in the full path yourself if you’d like.

And right-clicking on the desktop will produce the new menu item… naturally, using this menu item should launch Notepad++.

You can add as many applications to the desktop context menu as you’d like, just repeat the steps again with a new menu item name.

It is basically the same for other Windows versions too.

2
  • 1
    @kenorb I think I got it right, right? Oct 21, 2016 at 11:35
  • 3
    This doesn't answer the question 'Open files in N++ with context menu' but just adds an 'Open Notepad++' item to the context menu when right-clicking the Desktop.
    – pelms
    Nov 16, 2018 at 15:35
12

Corrected reg script (see above):

  1. Icon
  2. Spaces in name (for default Notepad++ filenames with spaces)
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Edit with Notepad++]
"Icon"="F:\\Program Files\\Notepad++\\notepad++.exe"

[HKEY_CLASSES_ROOT\*\shell\Edit with Notepad++\command]
@="\"F:\\Program Files\\Notepad++\\notepad++.exe\" \"%1\""
1
  • It works great ;)
    – Milos
    Dec 26, 2020 at 19:50
10

I've had a much simpler way I've used for ages. Save this as a file called Notepad++.right-click.reg:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Edit with Notepad++]
"Icon"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,20,\
  00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5c,00,\
  4e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2b,00,2b,00,5c,00,6e,00,6f,00,74,\
  00,65,00,70,00,61,00,64,00,2b,00,2b,00,2e,00,65,00,78,00,65,00,00,00

[HKEY_CLASSES_ROOT\*\shell\Edit with Notepad++\command]
@="C:\\Program Files (x86)\\Notepad++\\notepad++.exe %1"

Then just double-click it and choose Yes!

Edit
Amend the second entry to point to the Notepad++ executable as pointed out by @Sun, especially important if you install the 64 bit version.

4
  • 1
    If I wanted to context menu icon for NP++ to appear, I had to go into HCR and change the path of the binary to match the second entry. For my use, I am using 64-bit version in 64-bit OS so the ` (x86)` is not needed for me. Otherwise, great answer and works fast.
    – Sun
    May 28, 2019 at 17:10
  • Still works today. Thanks!
    – crudedude
    Jan 17, 2020 at 9:23
  • Is there a way to add this to something other than the non-root HKEY in the situation where we don't have admin access?
    – takanuva15
    Sep 17, 2021 at 21:56
  • String for 64 bit is 43,00,3A,00,5C,00,50,00,72,00,6F,00,67,00,72,00,61,00,6D,00,20,00,46,00,69,00,6C,00,65,00,73,00,5C,00,4E,00,6F,00,74,00,65,00,70,00,61,00,64,00,2B,00,2B,00,5C,00,4E,00,6F,00,74,00,65,00,70,00,61,00,64,00,2B,00,2B,00,2E,00,65,00,78,00,65,00,00,00 Nov 6, 2023 at 9:59
10

Instructions on how to do this here: https://npp-user-manual.org/docs/shell-extension/

In short, download the dll, register and voila!

3
  • N.B. Use NppShell64.dll even if you're using 32-bit N++ (the 64 refers to the OS). Also, need to run command line in Administrator mode.
    – pelms
    Jun 7, 2019 at 12:55
  • 2
    Where download the dll ?
    – ilw
    Apr 25, 2020 at 7:59
  • @ilw when you run the installer, there is an option you can select to add an context menu. Recent Notepad++ such as version 8.5.8 has this dll already installed to the folder Notepad++\contextMenu.
    – ollydbg23
    Oct 20, 2023 at 3:23
6

If the registry tweaking suggestion from Saimak is not something you want to try, adding a shortcut to the EXE file to the "Send To" list will allow you to right click any item and get it open in Notepad++.

The easiest way to access the "Send To" folder within which to create the shortcut is to enter shell:sendto in the Run box and press enter.

2
  • adding a shortcut to the EXE file to the "Send To" list - how would that be done? Oct 21, 2016 at 17:55
  • 2
    I see. Navigate to the "Send To" (details above), right click in the folder and select New and then Shortcut. In the resultant dialogue box enter the path to the Notepad++ EXE file. Click Next and the type a name for the shortcut and click Finish.
    – Dimblefeck
    Oct 24, 2016 at 8:42
2

If you are a user without administrator rights (e.g. you want to enable the context menu entry for Notepad++ on your business laptop), you can enable the Context menu entry "Edit with Notepad++..." by creating the relevant keys and entries in the Windows Registry at HKEY_CURRENT_USER\SOFTWARE\Classes instead of HKEY_CLASSES_ROOT.

The normal process used by the official Notepad++ installer by invoking the regsvr32 utility / invoking the associated DLL procedures will fail because of missing permission to write to the HKEY_CLASS_ROOT hive in the Windows Registry database due to missing privileges of a non-administrator user.

If you are interested, you can read the relevant code for the Notepad++ Context Menu / Shell Extension registration at https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/tools/NppShell/src/NppShell.cpp to find out / "reverse engineer" the relevant changes necessary in the Windows Registry and then do it on your own by mapping/replacing all references from HKEY_CLASSES_ROOT to HKEY_CURRENT_USER\SOFTWARE\Classes.

An appropriate Registry file to import via the Registry Editor that re-implements the same functionality but for non-elevated users may contain the following:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}]
@="Notepad++ Shell Extension"

[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}\InprocServer32]
@="C:\\Users\\...\\AppData\\Local\\Programs\\Notepad++\\NppShell_06.dll"
"ThreadingModel"="Apartment"

[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{B298D29A-A6ED-11DE-BA8C-A68E55D89593}\Settings]
"Title"="Edit with &Notepad++"
"Path"="C:\\Users\\...\\AppData\\Local\\Programs\\Notepad++\\notepad++.exe"
"Custom"=""
"ShowIcon"=dword:00000001
"Dynamic"=dword:00000019
"MaxText"=dword:00000001

[HKEY_CURRENT_USER\SOFTWARE\Classes\*\shellex\ContextMenuHandlers\ANotepad++64]
@="{B298D29A-A6ED-11DE-BA8C-A68E55D89593}"

Please note that

  • You need to change the paths of Notepad++ to the place where you placed the Notepad++ program files (in the example listing above, I extracted the program files from the installer by using 7-ZIP and placed them under %localappdata%\Programs with its own folder and used its absolute path). You can choose whatever location suits you as long as you have read/write access to it and as long as you can make sure that it will not be accidently deleted (and thus leaving dead references in the Windows Registry).
  • You need to extract the Shell extension DLL file named NppShell_06.dll (number may iterate in the future) from the installer (it is not supplied with the official portable ZIP archive / you can use 7-ZIP to extract the files from the installer), place it at an appropriate location and change the path to the DLL in the Windows Registry entry accordingly (see listing). In the listing above I kept the Shell Extension DLL at the same place where the other Notepad++ program files rest.
  • You can adjust the entries Title, Path, Custom, ShowIcon, Dynamic and MaxText under the Settings keys to your liking (the entries should be rather self-explaining and are normally changed by using the Settings UI that is triggered in the case of normal installation).
  • You may need to restart Windows Explorer to make the changes take effect.

Thanks to the participants in the thread at https://sourceforge.net/p/sevenzip/discussion/45798/thread/b036818c/ that served as a boilerplate!

Funny note aside: Windows (Explorer) uses the alphabetic order of key names under ContextMenuHandlers to determine the position in the Context menu, thus the name ANotepad in order to ensure its entry is at the top of Context menu items.

For more details about Shell extensions and how to register them, see the appropriate documentation at https://docs.microsoft.com/en-us/windows/win32/shell/reg-shell-exts.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .