在很多新系统中,如果精简了新版的记事本 打开方式选择 C:\Windows\System32\notepad.exe
就会出现无法将文件类型与此程序相关联
所选的程序不能与此文件类型相关联。请选择其他程序的情况
修复方法一:另存为 记事本修复.reg
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Applications\notepad.exe]
[-HKEY_CLASSES_ROOT\*\shell\copypath]
[-HKEY_CLASSES_ROOT\Directory\shell\copypath]
[HKEY_CLASSES_ROOT\.txt]
"Content Type"="text/plain"
"PerceivedType"="text"
@="txtfile"
[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\txtfile]
@="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\txtfile\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\txtfile\shell]
[HKEY_CLASSES_ROOT\txtfile\shell\open]
[HKEY_CLASSES_ROOT\txtfile\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\txtfile\shell\print]
[HKEY_CLASSES_ROOT\txtfile\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\txtfile\shell\printto]
[HKEY_CLASSES_ROOT\txtfile\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
[HKEY_CLASSES_ROOT\Applications\notepad.exe]
[HKEY_CLASSES_ROOT\Applications\notepad.exe\shell]
[HKEY_CLASSES_ROOT\Applications\notepad.exe\shell\edit]
[HKEY_CLASSES_ROOT\Applications\notepad.exe\shell\edit\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\Applications\notepad.exe\shell\open]
[HKEY_CLASSES_ROOT\Applications\notepad.exe\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
修复方法二:另存为 记事本修复.bat(编码 ANSI)
@echo off
title 修复记事本文件关联
echo 正在修复注册表,请以管理员身份运行...
echo.
:: ========== 删除冲突或废弃的注册表项 ==========
reg delete "HKCR\Applications\notepad.exe" /f >nul 2>&1
reg delete "HKCR\*\shell\copypath" /f >nul 2>&1
reg delete "HKCR\Directory\shell\copypath" /f >nul 2>&1
:: ========== 重新创建 .txt 关联 ==========
reg add "HKCR\.txt" /v "Content Type" /t REG_SZ /d "text/plain" /f >nul
reg add "HKCR\.txt" /v "PerceivedType" /t REG_SZ /d "text" /f >nul
reg add "HKCR\.txt" /ve /t REG_SZ /d "txtfile" /f >nul
reg add "HKCR\.txt\PersistentHandler" /ve /t REG_SZ /d "{5e941d80-bf96-11cd-b579-08002b30bfeb}" /f >nul
reg add "HKCR\.txt\ShellNew" /v "ItemName" /t REG_EXPAND_SZ /d "@%%SystemRoot%%\system32\notepad.exe,-470" /f >nul
reg add "HKCR\.txt\ShellNew" /v "NullFile" /t REG_SZ /d "" /f >nul
:: ========== 重建 txtfile 主键 ==========
reg add "HKCR\txtfile" /ve /t REG_SZ /d "Text Document" /f >nul
reg add "HKCR\txtfile" /v "EditFlags" /t REG_DWORD /d 0x00210000 /f >nul
reg add "HKCR\txtfile" /v "FriendlyTypeName" /t REG_EXPAND_SZ /d "@%%SystemRoot%%\system32\notepad.exe,-469" /f >nul
reg add "HKCR\txtfile\DefaultIcon" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\imageres.dll,-102" /f >nul
:: 创建 shell 分支
reg add "HKCR\txtfile\shell" /f >nul
reg add "HKCR\txtfile\shell\open" /f >nul
reg add "HKCR\txtfile\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\NOTEPAD.EXE %%1" /f >nul
reg add "HKCR\txtfile\shell\print" /f >nul
reg add "HKCR\txtfile\shell\print\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\NOTEPAD.EXE /p %%1" /f >nul
reg add "HKCR\txtfile\shell\printto" /f >nul
reg add "HKCR\txtfile\shell\printto\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\notepad.exe /pt \"%%1\" \"%%2\" \"%%3\" \"%%4\"" /f >nul
:: ========== 为 notepad.exe 应用程序添加显式命令 ==========
reg add "HKCR\Applications\notepad.exe" /f >nul
reg add "HKCR\Applications\notepad.exe\shell" /f >nul
reg add "HKCR\Applications\notepad.exe\shell\edit" /f >nul
reg add "HKCR\Applications\notepad.exe\shell\edit\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\NOTEPAD.EXE %%1" /f >nul
reg add "HKCR\Applications\notepad.exe\shell\open" /f >nul
reg add "HKCR\Applications\notepad.exe\shell\open\command" /ve /t REG_EXPAND_SZ /d "%%SystemRoot%%\system32\NOTEPAD.EXE %%1" /f >nul
echo 注册表修复完成!
pause
如果希望右键直接添加记事本打开
继续添加下面注册表即可
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\notepad] "Icon"="SHELL32.dll,-243" @="使用记事本打开 " [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\notepad\command] @="notepad %1"

