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
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值