Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何替换win11的默认经典记事本 #941

Open
madman43 opened this issue Dec 18, 2024 · 2 comments
Open

如何替换win11的默认经典记事本 #941

madman43 opened this issue Dec 18, 2024 · 2 comments

Comments

@madman43
Copy link

如何替换win11的默认经典记事本
image
添加这些注册表之后替换了,但是没有右键新建文本文档了

@qianxun365
Copy link

qianxun365 commented Dec 18, 2024

费那么大劲完全没必要,Notepad4.exe修改为Notepad.exe,替换掉系统自带的Notepad.exe就可以了

@betakernel
Copy link

批处理配合 setuserfta.exe 就能解决
下载地址 https://setuserfta.com/

批处理如下
`@ECHO Off
PUSHD %~DP0

NUL 2>&1 REG.exe query "HKU\S-1-5-19" || (
ECHO SET UAC = CreateObject^("Shell.Application"^) > "%TEMP%\Getadmin.vbs"
ECHO UAC.ShellExecute "%~f0", "%1", "", "runas", 1 >> "%TEMP%\Getadmin.vbs"
"%TEMP%\Getadmin.vbs"
DEL /f /q "%TEMP%\Getadmin.vbs" 2>NUL
Exit /b
)

::定义时间日期
setlocal enabledelayedexpansion
set nn=%date:~0,4%&set yy=%date:~5,2%&set rr=%date:8,2%&set xx=%date:-1,1%
set hh=%time:~0,2%&set mm=%time:~3,2%&set ss=%time:~6,2%

:Menu
mode con cols=55 lines=32 & color 0A & cls ::设置窗口宽、高、颜色和清屏
TITLE Notepad4 安装/卸载
echo ※※※※※※※※※※※ 主 菜 单 ※※※※※※※※※※※
echo.
echo 嗨,您好!管理员 %username%
echo.
echo 现在是:%nn%年%yy%月%rr%日 星期%xx% %hh%点%mm%分%ss%秒
echo.
echo ※※※※※※※※※※※ 功 能 区 ※※※※※※※※※※※
SET Options=
ECHO.&ECHO. 1.添加右键菜单
ECHO.&ECHO. 2.删除右键菜单
ECHO.&ECHO. 3.替换Windows默认记事本
ECHO.&ECHO. 4.恢复WIndows默认记事本
ECHO.&ECHO. 5.退出
ECHO.
SET /P Options=�[92m请输入选择项目序号并按回车确认:�[0m
IF /I "%Options%"=="1" GOTO installshellextension
IF /I "%Options%"=="2" GOTO uninstallshellextension
IF /I "%Options%"=="3" GOTO replacenotepad
IF /I "%Options%"=="4" GOTO recovernotepad
IF /I "%Options%"=="5" GOTO OUT
ECHO.&ECHO.序号无效,请重新输入!
PING -n 2 127.1>NUL
CLS
GOTO Menu

:installshellextension
::添加右键菜单
ECHO.&ECHO �[92m 添加右键菜单 �[0m
reg add "HKEY_CLASSES_ROOT*\shell\Notepad4" /t REG_SZ /v "" /d "使用 Notepad4 编辑" /f
reg add "HKEY_CLASSES_ROOT*\shell\Notepad4" /t REG_SZ /v "Icon" /d "%~dp0Notepad4.exe" /f
reg add "HKEY_CLASSES_ROOT*\shell\Notepad4\command" /t REG_SZ /v "" /d "%~dp0Notepad4.exe "%%1"" /f
::添加 Notepad4新建打开方式注册表项
ECHO.&ECHO �[92m 添加 Notepad4新建打开方式注册表项 �[0m
reg add "HKEY_CLASSES_ROOT\Applications\Notepad4.exe\shell\open\command" /t REG_SZ /v "" /d ""%~dp0Notepad4.exe" ""%%1""" /f
reg add "HKEY_CLASSES_ROOT\Applications\Notepad4.exe" /t REG_SZ /v "AppUserModelID" /d "Notepad4 文本编辑器" /f
reg add "HKEY_CLASSES_ROOT\Applications\Notepad4.exe" /t REG_SZ /v "FriendlyAppName" /d "Notepad4 文本编辑器" /f
::添加 grepWin
ECHO.&ECHO �[92m 添加 grepWin �[0m
reg add "HKCU\Software\grepWin" /t REG_SZ /v "languagefile" /d "%~dp0Chinese Simplified.lang" /f
reg add "HKCU\Software\grepWin" /t REG_DWORD /v "CheckForUpdates" /d "0" /f
::添加 matepath 鼠标右键菜单
ECHO.&ECHO �[92m 添加 matepath 鼠标右键菜单 �[0m
Reg.exe add "HKLM\SOFTWARE\Classes\Folder\shell\matepath" /ve /t REG_SZ /d "在 matepath 中打开" /f
Reg.exe add "HKLM\SOFTWARE\Classes\Folder\shell\matepath" /v "icon" /t REG_SZ /d "%~dp0matepath.exe" /f
Reg.exe add "HKLM\SOFTWARE\Classes\Folder\shell\matepath\command" /ve /t REG_SZ /d ""%~dp0matepath.exe" "%%1"" /f
Reg.exe add "HKLM\SOFTWARE\Classes\Applications\matepath.exe" /v "AppUserModelID" /t REG_SZ /d "matepath File Browser" /f
Reg.exe add "HKLM\SOFTWARE\Classes\Applications\matepath.exe" /v "FriendlyAppName" /t REG_SZ /d "matepath 文件浏览器" /f
Reg.exe add "HKLM\SOFTWARE\Classes\Applications\matepath.exe\shell\open\command" /ve /t REG_SZ /d ""%~dp0matepath.exe" "%%1"" /f
::添加 Notepad4主程序 文件夹访问限制白名单
ECHO.&ECHO �[92m 添加 Notepad4主程序 文件夹访问限制白名单 �[0m
powershell -inputformat none -outputformat none -NonInteractive -Command "Add-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0Notepad4.exe'"
powershell -inputformat none -outputformat none -NonInteractive -Command "Add-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0matepath.exe'"
powershell -inputformat none -outputformat none -NonInteractive -Command "Add-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0FindInFiles.exe'"
powershell -inputformat none -outputformat none -NonInteractive -Command "Add-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0grepWin.exe'"
cls
ECHO.
ECHO.&ECHO 右键菜单设置完成!按任意键,或者等待5秒钟后返回主菜单
IF EXIST "%WinDir%\System32\CHOICE.exe" (
ECHO.&ECHO 右键菜单设置完成!按任意键,或者等待5秒钟后返回主菜单
TIMEOUT /t 5 >NUL & CLS & GOTO MENU
) ELSE (
ECHO.&ECHO 已设置,任意键退出 &PAUSE>NUL&CLS&QUIT)

:uninstallshellextension
::删除右键菜单
ECHO.&ECHO �[92m 删除右键菜单 �[0m
reg delete "HKEY_CLASSES_ROOT*\shell\Notepad4" /f
::删除 Notepad4新建打开方式注册表项
ECHO.&ECHO �[92m 删除 Notepad4新建打开方式注册表项 �[0m
reg delete "HKEY_CLASSES_ROOT\Applications\Notepad4.exe" /f
::删除 grepWin
ECHO.&ECHO �[92m 删除 grepWin �[0m
reg delete "HKCU\Software\grepWin" /f
::删除 matepath 鼠标右键菜单
ECHO.&ECHO �[92m 删除 matepath 鼠标右键菜单 �[0m
Reg.exe delete "HKLM\SOFTWARE\Classes\Folder\shell\matepath" /f
Reg.exe delete "HKLM\SOFTWARE\Classes\Applications\matepath.exe" /f
::删除 Notepad4主程序 文件夹访问限制白名单
ECHO.&ECHO �[92m 删除 Notepad4主程序 文件夹访问限制白名单 �[0m
powershell -inputformat none -outputformat none -NonInteractive -Command "Remove-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0Notepad4.exe'"
powershell -inputformat none -outputformat none -NonInteractive -Command "Remove-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0matepath.exe'"
powershell -inputformat none -outputformat none -NonInteractive -Command "Remove-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0FindInFiles.exe'"
powershell -inputformat none -outputformat none -NonInteractive -Command "Remove-MpPreference -ControlledFolderAccessAllowedApplications '%~dp0grepWin.exe'"
cls
ECHO.
ECHO.&ECHO 右键菜单删除完成!按任意键,或者等待5秒钟后返回主菜单
IF EXIST "%WinDir%\System32\CHOICE.exe" (
ECHO.&ECHO 右键菜单删除完成!按任意键,或者等待5秒钟后返回主菜单
TIMEOUT /t 5 >NUL & CLS & GOTO MENU
) ELSE (
ECHO.&ECHO 已设置,任意键退出 &PAUSE>NUL&CLS&QUIT)

:replacenotepad
::替换Windows记事本 映像劫持(鼠标右键 编辑)
ECHO.&ECHO �[92m 替换Windows记事本 映像劫持(鼠标右键 编辑) �[0m
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /t REG_SZ /v "Debugger" /d ""%~dp0Notepad4.exe" /z" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /t REG_DWORD /v "UseFilter" /d "0" /f
::添加 Notepad4新建打开方式注册表项
ECHO.&ECHO �[92m 添加 Notepad4新建打开方式注册表项 �[0m
reg add "HKEY_CLASSES_ROOT\Applications\Notepad4.exe\shell\open\command" /t REG_SZ /v "" /d ""%~dp0Notepad4.exe" ""%%1""" /f
::设置(后缀.inf .ini .log .ps1 .psd1 .psm1 .scp .txt .wtx)默认Notepad4打开
ECHO.&ECHO �[92m 设置(后缀.inf .ini .log .ps1 .psd1 .psm1 .scp .txt .wtx)默认Notepad4打开 �[0m
for %%A in (.inf .ini .log .ps1 .psd1 .psm1 .scp .txt .wtx) do ("%~dp0SetUserFTA.exe" "%%A" "Applications\Notepad4.exe")
cls
ECHO.
ECHO.&ECHO 已替换默认记事本!按任意键,或者等待5秒钟后返回主菜单
IF EXIST "%WinDir%\System32\CHOICE.exe" (
ECHO.&ECHO 已替换默认记事本!按任意键,或者等待5秒钟后返回主菜单
TIMEOUT /t 5 >NUL & CLS & GOTO MENU
) ELSE (
ECHO.&ECHO 已设置,任意键退出 &PAUSE>NUL&CLS&QUIT)

:recovernotepad
::恢复Windows记事本 映像劫持(鼠标右键 编辑)
ECHO.&ECHO �[92m 恢复Windows记事本 映像劫持(鼠标右键 编辑) �[0m
Reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /f
Reg delete "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "UseFilter" /f
::删除 Notepad4新建打开方式注册表项
ECHO.&ECHO �[92m 删除 Notepad4新建打开方式注册表项 �[0m
reg delete "HKEY_CLASSES_ROOT\Applications\Notepad4.exe" /f
::恢复(后缀.inf .ini .log .ps1 .psd1 .psm1 .scp .txt .wtx)默认Windows记事本打开
ECHO.&ECHO �[92m 恢复(后缀.inf .ini .log .ps1 .psd1 .psm1 .scp .txt .wtx)默认Windows记事本打开 �[0m
for %%A in (.inf .ini .log .ps1 .psd1 .psm1 .scp .txt .wtx) do ("%~dp0SetUserFTA.exe" "%%A" AppX4ztfk9wxr86nxmzzq47px0nh0e58b8fw)
cls
ECHO.
ECHO.&ECHO 已恢复默认记事本!按任意键,或者等待5秒钟后返回主菜单
IF EXIST "%WinDir%\System32\CHOICE.exe" (
ECHO.&ECHO 已恢复默认记事本!按任意键,或者等待5秒钟后返回主菜单
TIMEOUT /t 5 >NUL & CLS & GOTO MENU
) ELSE (
ECHO.&ECHO 已设置,任意键退出 &PAUSE>NUL&CLS&QUIT)

:OUT
exit`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants