Created
November 20, 2025 11:46
-
-
Save La5u/9ab055b383d21c2e32ecc87a908fe10e to your computer and use it in GitHub Desktop.
Change Windows 11 files opening with notepad.exe to open with notepad++.exe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @ECHO OFF & CLS & ECHO. | |
| NET FILE 1>NUL 2>NUL & IF ERRORLEVEL 1 (ECHO You must right-click and select & ECHO "RUN AS ADMINISTRATOR" to run this batch. Exiting... & ECHO. & Timeout /t 10 & EXIT /B) | |
| REM ... proceed here with admin rights ... | |
| REM http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator | |
| SETLOCAL | |
| :: | |
| reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%ProgramFiles%\Notepad++\notepad++.exe\" -notepadStyleCmdline -z" /f | |
| reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\0" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad++.exe" /f | |
| reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\1" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad++.exe" /f | |
| reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\2" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad++.exe" /f | |
| ::Use the the following comment to undo the replacement: | |
| :: reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /f | |
| ENDLOCAL | |
| GOTO :EOF | |
| Technical Notes | |
| Replace Notepad on Windows 11 | |
| The following code Reverses the change | |
| ```@ECHO OFF & CLS & ECHO. | |
| NET FILE 1>NUL 2>NUL & IF ERRORLEVEL 1 (ECHO You must right-click and select & ECHO "RUN AS ADMINISTRATOR" to run this batch. Exiting... & ECHO. & Timeout /t 10 & EXIT /B) | |
| REM ... proceed here with admin rights ... | |
| REM http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator | |
| SETLOCAL | |
| ::Use the the following to Reset the default for Windows 11 notepad.exe to undo the replacement by Notepad++ | |
| reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /f | |
| reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\0" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad.exe" /f | |
| reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\1" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad.exe" /f | |
| reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\2" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad.exe" /f | |
| ENDLOCAL | |
| GOTO :EOF | |
| Technical Notes | |
| Replace Notepad | |
| This has only been lightly tested but works for .cmd files and .txt files and perhaps others. Let us know if there are issues. |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
origin:
https://community.notepad-plus-plus.org/topic/21991/replace-notepad-on-windows-11/16
jadeline