Windows – Can Notepad++ be made to open file links in itself

file associationlinksnotepadprotocolwindows

In Settings/Preferences, Notepad++ has an option on the MISC. tab under 'Clickable Link Settings' to the right, to Enable to open links found in the edited files. It underlines them and opens them on double-click. I've tried it with the file:/// protocol and it works, but it actually executes them according to whatever file-association I have set in Windows.

Is there a way, a protocol, or a way to "make" a (local) protocol, such that Notepad++ opens any kind of files (any extension), from these links in the document, in Notepad++ itself? (ie in another tab)

Best Answer

file:// is an intrinsic protocol of Windows, so if you want to ignore the "whatever file-association [is] set in Windows," i'd suggest you use a dedicated protocol, say npp://. Then add this to your registry (using the corresponding path on your system):

[HKEY_CLASSES_ROOT\NPP]
@="URL: NotePad++ Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\NPP\DefaultIcon]
@="\"C:\\Program Files\\Notepad++\\notepad++.exe\""

[HKEY_CLASSES_ROOT\NPP\shell]

[HKEY_CLASSES_ROOT\NPP\shell\open]

[HKEY_CLASSES_ROOT\NPP\shell\open\command]
@="\"C:\\Program Files\\Notepad++\\notepad++.exe\" \"%1\""
Related Question