Replacing Notepad with Notepad++

2009-10-20
2012-11-13
  • 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
    > location:
    > HKLM\Software\Microsoft\Windows
    > NT\CurrentVersion\Image File Execution
    > Options\
    >
    > 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!

     
  • ILme
    ILme
    2009-10-21

    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

     
  • ILme
    ILme
    2009-10-21

    If somebody else wants to test…

    http://www.file-upload.net/download-1959010/NppReplacementLoader.zip.html

    You would have to place the loader into Notepad++ folder and write into the registry like mentioned by teamterradactyl:

            REGEDIT4
       
       
        "Debugger"="C:\\Program Files\\Notepad++\\NppReplacementLoader.exe"

     
  • cchris
    cchris
    2009-10-21

    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.

    CChris

     
  • ILme
    ILme
    2009-10-21

    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…

    http://www.file-upload.net/download-1959211/NppReplacementLoader.7z.html

     
  • Ivan
    Ivan
    2010-01-31

    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.

     

  • Anonymous
    2010-02-16

    ufo-pu55y,

    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.

    Any suggestions?

    Thanks

    Mark

     
  • UFO
    UFO
    2010-02-16

    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…

     
  • Randy Croan
    Randy Croan
    2010-03-17

    For Windows 7 Ultimate, I like the replacement method.
    download the following:

      http://notepad-plus.sourceforge.net/commun/misc/NppLauncher.bin.zip
     
    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

      c:\Windows\notepad.exe
      c:\Windows\System32\notepad.exe
      c:\Windows\SysWOW64\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.

      HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Notepad++
      C:\Program Files (x86)\Notepad++

    PS: for Win Vista the permission command should be:
      cacls /f c:\Windows\notepad.exe /G n0tig:F

     
  • Nik R
    Nik R
    2010-03-23

    In Win x64 if you make replacement manually in addition to replacements described at notepad-plus.sourceforge.net make the followings:
    1. c:\windows\servicepackfiles\i386
    2. c:\windows\system32\dllcache
    3. c:\windows\system32\dllcache\wnotepad.exe
    4. c:\windows\system32
    5. c:\windows\syswow64
    6. c:\windows

     
  • Niko Verbeke
    Niko Verbeke
    2011-11-23

    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:

    Option Explicit
    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) & ""
    Next
    'MsgBox(sCmd)
    CreateObject("WScript.Shell").Run sCmd, 1, True
    WScript.Quit

    Let me know what you think.

     

  • Anonymous
    2012-05-07

    When I close Notepad ++, I get an error dialog: