Advertisement
FreeBooter

OpenWithNotepad.bat

Aug 28th, 2017
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.40 KB | None | 0 0
  1. @Echo Off
  2. Color 1A
  3.  
  4. Cd %systemroot%\system32
  5.  
  6.  
  7. REM  --> Check for permissions
  8. Reg query "HKU\S-1-5-19\Environment"
  9. REM --> If error flag set, we do not have admin.
  10. if %errorlevel% NEQ 0 (
  11. ECHO                 **************************************
  12. ECHO                  Running Admin shell... Please wait...
  13. ECHO                 **************************************
  14.  
  15.     goto UACPrompt
  16. ) else ( goto gotAdmin )
  17.  
  18. :UACPrompt
  19.     echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  20.     set params = "%*:"=""
  21.     echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
  22.  
  23.     "%temp%\getadmin.vbs"
  24.     del "%temp%\getadmin.vbs"
  25.     exit /B
  26.  
  27.  
  28. :gotAdmin
  29.  
  30. Cls & Mode CON  LINES=11 COLS=100 & Color 0D & Title Created By FreeBooter
  31. Echo.
  32. Echo.
  33. Echo.
  34. Echo       ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  35. Echo       º Do You Want To Add Open with Notepad to the Windows Context Menu for All Files (Y/N)? º  
  36. Echo       ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  37. Echo.
  38. Echo.
  39.  
  40.  
  41. Set /p input= RESPONSE:
  42. If /i  Not %input%==Y (Goto :_Ex) Else (Goto :_Start)
  43.  
  44. :_Ex
  45. If /i Not %input%==N  (Goto :EOF) Else (Goto :_RegRestore)
  46.  
  47.  
  48.  
  49. :_Start
  50.  
  51. Reg add "HKCR\*\shell\Open with Notepad\command" /ve /t REG_SZ /d "notepad.exe %%1" /f >Nul
  52.  
  53. Cls & Mode CON  LINES=11 COLS=45 & Color 0D & Title Created By FreeBooter
  54. Echo.
  55. Echo.
  56. Echo.
  57. Echo       ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  58. Echo       º Open with Notepad Enabled º  
  59. Echo       ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  60. Echo.
  61. Echo.
  62. ping -n 6 localhost >nul
  63.  
  64.  
  65. Exit
  66.  
  67.  
  68.  
  69.  
  70. :_RegRestore
  71.  
  72. Reg Query "HKCR\*\shell\Open with Notepad" >Nul
  73.  
  74. If %ErrorLevel% EQU 1 Goto :EOF
  75.  
  76.  
  77. Reg.exe delete "HKCR\*\shell\Open with Notepad" /f >Nul
  78.  
  79.  
  80. Cls & Mode CON  LINES=11 COLS=45 & Color 0D & Title Created By FreeBooter
  81. Echo.
  82. Echo.
  83. Echo.
  84. Echo       ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  85. Echo       º Open with Notepad Disabled º  
  86. Echo       ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  87. Echo.
  88. Echo.
  89. ping -n 8 localhost >nul
  90.  
  91. Exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement