Page 1 of 1

Changing the Default Text Editor (for Dummies)

Posted: 2010 Jun 21, 11:44
by Kilmatead
This may seem like a "no-brainer" for most people - to change the default editor from Notepad to something else, either play around in the registry a bit or just change the filetype associations, right?

Not quite.  Even though you've gone through all the trouble of making ed2 or Notepad++ or Notepad2 (or whatever you use) the default text editor, there's always some smart-arse application (such as the x2 installation program) which insists upon opening the changes.txt by default in Windows notepad, regardless of your wishes.  To combat things like this the usual route is to actually replace the C:\Windows\System32\notepad.exe physically, which seems a little dirty for some people.

Curiously, someone thought up the NotePadReplacer utility, which does exactly what it says on the tin - even intercepting direct calls to the notepad.exe and opening your chosen editor instead.

I am a little curious how it manages to intercept the notepad.exe itself (if you click on it you get your chosen editor - almost as if the file was replaced - except it wasn't.  Interesting.

Anyway, this is a clean and simple solution for those who don't like poking around windows entrails for little obvious things.

Works fine with editor2.exe and editor2_x64.exe, though I don't know what happens if you try to associate portable editors with it.

(Now, if someone would create one of these for firefox.exe we'd be able to eradicate all of Nikos' little oversights! :D)

Posted: 2010 Jun 21, 17:28
by nikos
did you try the registry key
HKEY_CLASSES_ROOT\SystemFileAssociations\text

Posted: 2010 Jun 21, 17:55
by Kilmatead
nikos wrote:did you try...
I'm merely positing this as a simple and clean solution for people who don't enjoy trekking through the registry detritus, unlike some jazzy-coders. :wink:

And if you find this so simplistic, how is it you eternally fail to respect the user's choice of default browser in "that other application" of yours?

Hmm?  (Listening to crickets playing violins...)

I thought so.  :rolleyes:

Re: Changing the Default Text Editor (for Dummies)

Posted: 2010 Jun 21, 20:02
by Tuxman
Kilmatead wrote:Curiously, someone thought up the NotePadReplacer utility, which does exactly what it says on the tin - even intercepting direct calls to the notepad.exe and opening your chosen editor instead.
Now that I wasted lots of hours changing several registry entries in order to make everything on my system work alright with my beloved Vim, this is certainly a great idea. Thank you!  :)

Posted: 2010 Jun 22, 01:05
by FrizzleFry
NotePadReplacer might be using the method described here to "replace" Notepad.

Posted: 2010 Jun 22, 07:39
by Kilmatead
Image

Yep, looks like a "re-direction of a re-direction" using the same registry keys.  Probably using its own call to iron out whatever those "incompatibilities" mentioned for np2 were, so other editors don't need to worry about needing modifications.

Interesting solution, but it works.

Posted: 2010 Jul 19, 18:27
by Kilmatead
For anyone interested in following up (or exploiting for their own use) the IFEO (Image File Execution Options) registry trick, see here for a practical tutorial.

Apparently if you "just" add the requisite application names to the registry, windows automatically inserts a copy of the called path as a passed command line argument, which is impractical.  The above tutorial provides example VBS code to circumvent said inconvenience.  Very useful for redirecting regedit.exe calls and the like, for those desperate to do such things. :wink: