Advertisement
FreeBooter

USBWriteProtection.bat

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