Skip to content

Instantly share code, notes, and snippets.

@rampageX
Created February 12, 2022 13:43
Show Gist options
  • Save rampageX/ef0c68a5e0713ad88b3963c68c31db47 to your computer and use it in GitHub Desktop.
Save rampageX/ef0c68a5e0713ad88b3963c68c31db47 to your computer and use it in GitHub Desktop.
replace notepad with notepad2/notepad3/notepad++ on Windows11
@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 "\"%~dp0Notepad3.exe\" /z" /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\0" /v "FilterFullPath" /t REG_SZ /d "\"%~dp0Notepad3.exe\" /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\1" /v "FilterFullPath" /t REG_SZ /d "\"%~dp0Notepad3.exe\" /f
reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\2" /v "FilterFullPath" /t REG_SZ /d "\"%~dp0Notepad3.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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment