Replacing Windows Notepad with Notepad2 4.1.24 (or newer)

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

Enable Jump List Support

A few more tweaks are needed to enable recent file access through the jump lists introduced with Windows 7. First, register Notepad2 as an "Open with" handler using the following batch script (run from the Notepad2.exe directory with elevated privileges):

reg add "HKCR/*/OpenWithList/Notepad2.exe" /f
reg add "HKCR/Applications/Notepad2.exe" /v "AppUserModelID" /t REG_SZ /d "Notepad2" /f
reg add "HKCR/Applications/Notepad2.exe/shell/open/command" /ve /t REG_SZ /d "/"%~dp0Notepad2.exe/" %%1" /f

Next, apply the following changes to the Notepad2.ini file:

[Settings2]
...
ShellAppUserModelID=Notepad2
ShellUseSystemMRU=1

Recent files now appear in the jump lists. Notepad2 windows are now assigned to a custom AppUserModelID, that's why multiple icons may appear if Notepad2.exe is directly pinned to the taskbar. To fix this, open a Notepad2 window first, and then pin it to the taskbar from the Notepad2 taskbar button context menu.

Unregister the Notepad2 "Open with" handler with the following script (requires elevated privileges):

reg delete "HKCR/*/OpenWithList/Notepad2.exe" /f
reg delete "HKCR/Applications/Notepad2.exe" /f

你可能感兴趣的:(windows,command,File,delete,System,icons)