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.

Revisions

  1. rampageX created this gist Feb 12, 2022.
    15 changes: 15 additions & 0 deletions Replace_Notepad_Win11.cmd
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    @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