views:

194

answers:

1

just as this link says : http://untidy.net/blog/2009/11/03/replacing-notepad-with-pn-via-image-file-execution-options/

I wanna replace Notepad.exe to Notepad2.exe using "Image File Execution Options" function by run this command

reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"c:\windows\Notepad2.exe\" /z" /f

but, when I run notepad, it open file c:\windows\notepad.exe in notepad2.exe as a text file by default. Is there a way to avoid that?

I know using this tech Notepad.exe will as the first param passed to Notepad2.exe. but I don't know how to avoid this :(

A: 

From Here Replacing Windows Notepad with Notepad2 4.1.24 (or newer)

As of version 4.1.24, the official release of Notepad2 supports this method for replacing Windows Notepad, so the steps outlined above will work fine. However, there's no support to perform the Notepad replacement automatically, as the official release of Notepad2 will not modify the system registry. For the same reason, there's no support for accessing recent files through the Windows 7 jump lists, by default (this requires registration of applications in the system registry, first).

Also be aware that automated Notepad replacement could have undesirable effects if Notepad2 was used as a Notepad replacement from a portable device, and the original state was not restored when disconnecting the device.

A batch script to run from the Notepad2 directory and replace Windows Notepad might look like this (requires elevated privileges):

reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%~dp0Notepad2.exe\" /z" /f The Windows Notepad can be restored with this command (requires elevated privileges):

reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /f

fenster
Thanks for you answer. but when I execute the reg add command, I can't run notepad, told me can not found, if I change %~dp0Notepad2.exe to Notepad2.exe(I put this to c:\windows\system32), when run notepad, it opened Notepad2, but, the default opened document is notepad.exe, not for blank doc.
Weixiao.Fan
I think the red add command is a little tricky. Try create the key manually or use this in the reg add as a test: /d "c:\utils\Notepad2.exe /z"
fenster

related questions