2011-05-21

转:Replacing Windows Notepad with Notepad2

Replacing Windows Notepad with Notepad2 can be a little tricky since notepad.exe is a protected system file, which makes a direct replacement a bit difficult (though not impossible).

There is an easier way to replace Windows Notepad by using the "Image File Execution Options" registry key to trick Windows into running notepad2.exe whenever notepad.exe is run. This same trick is used by the "Replace Task Manager" function in Microsoft's Process Explorer. The benefit to using this method to replace Notepad is that you will not run afoul of Windows File Protection (since you are not actually replacing the executable itself), and you can undo it at any time by simply deleting the registry key. The downside to this method is that it does not work properly with the official Notepad2 build; there are a few minor changes that need to be made to Notepad2 in order for this to work (see my img_exec_replace patch).

In order to use this method of Notepad replacement, you will need to follow these steps:

Obtain a build of Notepad2 that supports this form of Notepad replacement.
Create the following registry key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe.
Inside the key, create a new string (REG_SZ) value, named "Debugger".
Set the data of this new "Debugger" value to the full path to the Notepad2 executable, followed by the /z switch. For example, "C:\Windows\Notepad2.exe" /z


原链接:http://www.flos-freeware.ch/doc/notepad2-Replacement.html