I'm surprised to see so many "fixes" to get Notepad++ working in place of Notepad. Most especially, the fact that the Window's original "Notepad.exe" file needs to be replaced (in multiple places).
If any of you have used Process Explorer by SysInternals (now part of Microsoft, but still maintained by the creator), they have a way to replace any instances that try to open TaskManager with itself (ProcessExplorer). It's done through a single registry entry.
http://sbs.seandaniel.com/2009/03/replacing-windows-applications-safe-way.html describes how to do this (you'll replace "Notepad 2" and its path with "Notepad++" and its path):
> Open Regedit, and navigate to this
> NT\CurrentVersion\Image File Execution
> Create a new KEY for the name of the
> executable, for example “Notepad.exe”
> (without the quotes).
> In this new Key, create a new string
> value called “Debugger” without the
> quotes, and give it the value of the
> path to Notepad2. E.g. “c:\Program
> Files\Notepad 2\Notepad2.exe”
I hope this helps; and by all means, post feedback if you come up with a different (better?) solution!
Wow, nice find! For testing I quickly set up a npp loader, which sorts out the 'wrong' commandline args.. pushed into that registry path. Works great ! Shouldn't be hard to implement into Npp.. tho gets a little tricky, when it comes to sorting out the args of multiple documents in the commandline. Because I had space-containing but nevertheless unquoted(!) document paths :S
If somebody else wants to test…
You would have to place the loader into Notepad++ folder and write into the registry like mentioned by teamterradactyl:
Isn't this the "non destructive" method mentioned in this forum and (http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Replacing_Notepad)?
Can someone knowledgeable with Vista / Win 7 issues review the current page and either report any duplicates or obsolete solutions, or clean the page him/herself? I don't (wish to) have these Window versions, so I cannot test and get my own opinion on the pros and cons of each method.Obviously, things that work differ depending on your having admin rights.
Whoops, you're right. As I don't (wish to) use VBS stuff, I didn't test it, but the approach is identical.
Anyway, at least I want to update my last upload. I had to fix one more thing and this time I included a batch file for doing the registry stuff. I've tested it in a Win7x64 image and it worked ok for me. Ofc you need admin rights for registering.. like mentioned in the Wiki…
downloaded nppReplacementLoader.exe, installed as directed, does not work. i installed npp in default location (c:\program files\notepad++\) and put nppReplacementLoader.exe there as well. Added the registry key, and when i attempt this command line ("notepad x.x" where x.x is a file that exists) i get the following dialog box contents "otepad x.x doesn't exist. create it?" and the file x.x is not opened. same result if i find x.x and right click then select edit.
the method that uses the VBS script DOES work.
Sry, my bad… I fixed that long time ago, but forgot to upload the fixed version:
this time it WOULD work.
I used the .bat in the archive and everything seems to be OK except when I want to edit more than one file. The first time I double click a .txt file, Notepad++ launched properly with the file. If I double-click another file, a 2nd instance of Notepad++ open with that file.
I did that intentionally, it's not an issue! ^^
The loader adds the commandline option "-multiInst", if it doesn't already exist.
I did that because it's what we would get with the original notepad.exe.
I usually pick "Edit with Notepad++" in the filecontextmenu, when I want several files in one instance.
The loader is.. let's say for "indirect" opening of N++. For example, when you're in a web-browser and
select "Show source". Usually it would open up in Notepad.exe, but with the loader in N++ instead…
For Windows 7 Ultimate, I like the replacement method.
download the following:
Follow the instructions in the package, such as keep a copy of notepad.exe just in case.
The folders in the package are for Win XP,
for Win 7 they are as follows, and you will find you can't overwrite the original notepad.exe
You have to take ownership, and give yourself full authority before it can be overwritten.
here are commands for each folder, substitute your userid in place of n0tig.
You must open an "Elevated Command Prompt" means you have admin privilages for any command you enter at the prompt.
To get one, Right click on Command Prompt icon and select Run as administrator.
takeown /f c:\Windows\notepad.exe
Icacls c:\Windows\notepad.exe /grant:r n0tig:(F)
takeown /f c:\Windows\System32\notepad.exe
Icacls c:\Windows\System32\notepad.exe /grant:r n0tig:(F)
takeown /f c:\Windows\SysWOW64\notepad.exe
Icacls c:\Windows\SysWOW64\notepad.exe /grant:r n0tig:(F)
Now you can replace notepad.exe in these folders with the one from the package.
Just as the package does, I also reccomend you use the installer to install Notepad++ so you don't have to mess with the registry.
But if you're a glutton for punisment, here's where the installer put my reg entry.
C:\Program Files (x86)\Notepad++
PS: for Win Vista the permission command should be:
cacls /f c:\Windows\notepad.exe /G n0tig:F
In Win x64 if you make replacement manually in addition to replacements described at notepad-plus.sourceforge.net make the followings:
There was 1 problem with vbs script, it didn't work with files in folders with spaces.
I've tried to create an updated version:
Dim sCmd, x
sCmd = """" & LeftB(WScript.ScriptFullName, LenB(WScript.ScriptFullName) - LenB(WScript.ScriptName)) & "notepad++.exe" & """"
For x = 1 To WScript.Arguments.Count - 1
sCmd = sCmd & " " & WScript.Arguments(x) & ""
CreateObject("WScript.Shell").Run sCmd, 1, True
Let me know what you think.
When I close Notepad ++, I get an error dialog: