Can Notepad++ be made to open file links in itself?
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\""
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
.