Easy Notepad Replacement for Notepad++

Share tools which are especially useful in combination with Opus.
User avatar
Sasa
H&P
Posts: 2258
Joined: 27 Aug 2006, 09:36
OS: Windows 10 64-bit
Opus: Latest Beta
Location: Germany
I found an elegant and "non-hacking" method replacing Windows' notepad with notepad++. You don't need to replace the notepad.exe or assign x filetypes - it just adds one registry-entry and runs systemwide :-)!

In the download package there're two files:

- notepad_replacer.vbs (Notepad++ folder)
- Notepad Replacer.reg

1. Copy the "notepad_replacer.vbs" to your Notepad++ folder.

Code: Select all

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
sCmd = sCmd & """"
CreateObject("WScript.Shell").Run sCmd, 1, True
WScript.Quit

2. In "Notepad Replacer.reg" change the path to the "notepad_replacer.vbs" to yours and import it (I use the portable version of Notepad++ and have included it into DO's scripts-folder).

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"Debugger"="wscript.exe \"C:\\Users\\<YOUR NAME>\\AppData\\Roaming\\GPSoftware\\Directory Opus\\Scripts\\Notepad++\\Notepad_Replacer.vbs\""

For restoring to default notepad.exe just delete the above entry in regedit!

Download:
Attachments
Notepad Replacer.zip
(978 Bytes) Downloaded 318 times

User avatar
jon
GPSoftware
Posts: 7412
Joined: 04 Nov 2004, 02:40
OS: Windows 10 64-bit
Opus: Latest Beta
Location: Melbourne
Contact:
Or just do right-click -> Open With on a text file :)

User avatar
Sasa
H&P
Posts: 2258
Joined: 27 Aug 2006, 09:36
OS: Windows 10 64-bit
Opus: Latest Beta
Location: Germany
...and with vbs, xml, js, php, ini, dat, vb, nfo, cfg,... and what about unknown filetypes?!! Too much "open with", esp. on fresh installations ;-).

Of course I also use DO-filetypes for USB-version.

User avatar
leo
GPSoftware
Posts: 36498
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:
Sasa wrote:I found an elegant and "non-hacking" method replacing Windows' notepad with notepad++.

Registry settings to assign wscript.exe as the debugger for Notepad.exe so it runs a script which diverts to another program... Seems pretty hacky to me.

May also break things which launch notepad.exe and wait for it to be closed or try to interact with it in some way.

Filetypes are for doing this. Don't fight the system. :)

User avatar
Sasa
H&P
Posts: 2258
Joined: 27 Aug 2006, 09:36
OS: Windows 10 64-bit
Opus: Latest Beta
Location: Germany
I never had any problems on different machines (daily use).

If you want an easy replacement without doing xx changes and also need it outside DO/Explorer and often open unknown/unregistered filetypes, there's no other way and IMO this is the best solution (all other solutions are either using an exe for replacing notepad.exe or modify xx reg-entries). You can see what it does and you can easily set it to default again by simply removing the reg-entry.

"Open with" is no solution (the same like with DO-viewer) - I don't want to assign each filetype I may open the way I want and the reg-templates simply doesn't work on all machines (and broke everything).

Be sure that I heavily test a solution before using it in a productive environment or offering here, I don't fight my sys. :-)

SomeYoungGuy
Registered Opus Pro User
Posts: 193
Joined: 07 Dec 2013, 08:31
OS: Windows 8 64-bit
Opus: Directory Opus 12
Sasa wrote:...and with vbs, xml, js, php, ini, dat, vb, nfo, cfg,... and what about unknown filetypes?!! Too much "open with", esp. on fresh installations ;-).

Of course I also use DO-filetypes for USB-version.


You could set all of the file associations from within Notepad++ in one place: Settings > Preferences > File Association

User avatar
Sasa
H&P
Posts: 2258
Joined: 27 Aug 2006, 09:36
OS: Windows 10 64-bit
Opus: Latest Beta
Location: Germany
Nope, that won't work when working outside of DO.

As said I don't have any problems with "my" solution. No breaks, no waits, nothing :-).

User avatar
leo
GPSoftware
Posts: 36498
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:
I think SomeYoungGuy meant this, in Notepad++:

notepadpp-file-association.png
notepadpp-file-association.png (16.29 KiB) Viewed 7818 times

User avatar
Sasa
H&P
Posts: 2258
Joined: 27 Aug 2006, 09:36
OS: Windows 10 64-bit
Opus: Latest Beta
Location: Germany
Ah ok, but Windows also will open unknown filetypes with notepad then.

There's simply no "clean" option to completely replace notepad (except replacing the exe, but that's tricky and you run into other problems then). Same with file dialogues.

qupear
Posts: 1
Joined: 13 Mar 2015, 02:26
OS: Windows 7 64-bit
Opus: Directory Opus 10
I got this
Image

User avatar
leo
GPSoftware
Posts: 36498
Joined: 07 Nov 2004, 01:30
OS: Windows 10 64-bit
Opus: Directory Opus 12
Location: London, UK
Contact:
The script needs to be in the same folder as Notepad++.exe, or you need to edit the script to use a specific path to the exe instead of the script's folder.

User avatar
playful
Registered Opus Pro User
Posts: 621
Joined: 15 Nov 2011, 02:10
OS: Windows 7 64-bit
Opus: Latest Beta
Location: Not sure, maybe on the way to Noosa?
Contact:
An additional tip that's a bit out of the box: I have a Ctrl + Sh + E shortcut to open files in EditPad Pro -- you could do that for N++.
I use that shortcut to edit files with weird extensions (or no extensions!), as well as files that are normally opened by an IDE.

Similarly I have a shortcut to open things in Photoshop, instead of the default (the internal image viewer).
Born-again Opusian since 2007 (9.0)
My pets: dearOpus.com : tuts // Regex = RexEgg // The Funniest Movies


Return to “Tools”