GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Easy Notepad Replacement for Notepad++


#1

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 :slight_smile:!

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.
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
  1. 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).
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:
Notepad Replacer.zip (978 Bytes)


#2

Or just do right-click -> Open With on a text file :slight_smile:


#3

...and with vbs, xml, js, php, ini, dat, vb, nfo, cfg,... and what about unknown filetypes?!! Too much "open with", esp. on fresh installations :wink:.

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


#4

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. :slight_smile:


#5

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. :slight_smile:


#6

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


#7

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 :slight_smile:.


#8

I think SomeYoungGuy meant this, in Notepad++:



#9

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.


#10

I got this


#11

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.


#12

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