今天准备用notepad3替换win11自带的记事本程序,于是就把记事本卸载了,结果右键的“新建文本文档”不见了,网上搜了很多教程,不是需要恢复记事本程序,就是不管用,不过,最终还是找到了解决方法,编辑注册表,代码如下:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.txt]
@="txtfilelegacy"
"Content Type"="text/plain"
"PerceivedType"="text"
[HKEY_CLASSES_ROOT\.txt\PersistentHandler]
@="{5e941d80-bf96-11cd-b579-08002b30bfeb}"
[HKEY_CLASSES_ROOT\.txt\ShellNew]
"ItemName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,\
  6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,\
  00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,2c,00,\
  2d,00,34,00,37,00,30,00,00,00
"NullFile"=""
[HKEY_CLASSES_ROOT\txtfilelegacy]
@="Text Document"
"EditFlags"=dword:00210000
"FriendlyTypeName"=hex(2):40,00,25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,\
  00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,\
  32,00,5c,00,6e,00,6f,00,74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,\
  00,2c,00,2d,00,34,00,36,00,39,00,00,00
[HKEY_CLASSES_ROOT\txtfilelegacy\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,69,00,6d,00,\
  61,00,67,00,65,00,72,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,31,\
  00,30,00,32,00,00,00
[HKEY_CLASSES_ROOT\txtfilelegacy\shell]
[HKEY_CLASSES_ROOT\txtfilelegacy\shell\open]
[HKEY_CLASSES_ROOT\txtfilelegacy\shell\open\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,25,00,31,00,00,\
  00
[HKEY_CLASSES_ROOT\txtfilelegacy\shell\print]
[HKEY_CLASSES_ROOT\txtfilelegacy\shell\print\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,4e,00,4f,00,\
  54,00,45,00,50,00,41,00,44,00,2e,00,45,00,58,00,45,00,20,00,2f,00,70,00,20,\
  00,25,00,31,00,00,00
[HKEY_CLASSES_ROOT\txtfilelegacy\shell\printto]
[HKEY_CLASSES_ROOT\txtfilelegacy\shell\printto\command]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
  00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,6e,00,6f,00,\
  74,00,65,00,70,00,61,00,64,00,2e,00,65,00,78,00,65,00,20,00,2f,00,70,00,74,\
  00,20,00,22,00,25,00,31,00,22,00,20,00,22,00,25,00,32,00,22,00,20,00,22,00,\
  25,00,33,00,22,00,20,00,22,00,25,00,34,00,22,00,00,00

使用方法:

将代码复制到记事本中,另存为.reg文件,双击导入,刷新下就可以在右键新建菜单中看到久违的“新建文本文档”了。

另外,再附上“用记事本打开”的右键菜单注册表

[HKEY_CLASSES_ROOT\*\shell\Notepad]
@="用记事本打开"
[HKEY_CLASSES_ROOT\*\shell\Notepad\Command]
@="notepad %1"

懒人方法:

下载附件,解压双击导入

win11 新建文本文档+用记事本打开.zip