The Computer Oracle

Can Notepad++ be made to open file links in itself?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Underwater World

--

Chapters
00:00 Can Notepad++ Be Made To Open File Links In Itself?
00:37 Accepted Answer Score 7
01:07 Answer 2 Score 2
02:22 Answer 3 Score 0
02:52 Answer 4 Score 0
03:19 Thank you

--

Full question
https://superuser.com/questions/585758/c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #notepad++ #fileassociation #protocol #links

#avk47



ACCEPTED ANSWER

Score 7


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):

Windows Registry Editor Version 5.00
[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\""



ANSWER 2

Score 2


The given answer did not work for my Windows 7 Pro system. The parameter %1 was never (correctly) provided to NotePad++ and it started with an empty new file.

However instead I started a batch file through @=c:\soft\start-notepad.bat "%1" In this batch file I stripped off the NPP:/// prefix from %1 and replaced / with \ inside of %1. From this batch file the start of NotePad++ with the modified parameter %1 does work perfectly. Here is the short batch file code:

start-notepad.bat

set note=insert here the path to notepad++.exe
set para1=%1%
SETLOCAL ENABLEDELAYEDEXPANSION 
set para1=!para1:edit:///=!
set para1=!para1:/=\!
%note% %para1%

The quotation marks "%1" around %1 are not really necessary, because paths or filenames with spaces or special symbols will anyhow result in broken hyperlinks in Notepad++.

If necessary this has to be corrected in NotePad++ with e.g. %20 for the "space", otherwise the hyperlinking of link NPP:///c:/path/file name.txt will stop after file.




ANSWER 3

Score 0


In Notepad++ v8.3.3 (64bit, Win 11) I am able to open file URLs in notepad++ with one slight modification. The clicked file opens as a new tab in notepad++. For some reason, I need to write:

file:///C:/Me/Documents/My%20File.txt

Note the extra slash after file://.

No other changes made




ANSWER 4

Score 0


Later versions of Notepad++ have added this ability directly. No URI syntax is necessary; just the filename itself. For example, the document you're editing contains:

for details, see ../other/file.txt

Position the cursor within the file path, right-click, and select "Open File". Notepad++ opens the file.

Don't know when they added this, but v8.6.5 has it.