Advertisement
Guest User

block all exe in folder

a guest
Jul 4th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. @ echo off
  2. @setlocal enableextensions
  3. @cd /d "%~dp0"
  4. color F0
  5. title Exe blocker
  6. echo.
  7. echo. ==============================
  8. echo. == Welcome to .exe blocker ==
  9. echo. ==============================
  10. echo.
  11. Echo Current location: %cd%
  12. echo.
  13. CHOICE /C YN /M "Do you want to search in the current location?"
  14. IF Errorlevel 2 goto END
  15. IF Errorlevel 1 goto Yes
  16.  
  17.  
  18.  
  19.  
  20. ::--------------------CHECK and searching files-----------------
  21. :Yes
  22. set location=%cd%
  23. cls
  24. echo.
  25. Echo. Searching for .exe files in %location%
  26. echo.
  27. set /a count=0
  28. echo.___________________________________________
  29. echo.Found:
  30. echo.
  31. FOR %%i in (*.exe) do (echo. %%i & set /a count+=1)
  32. echo.___________________________________________
  33. echo.
  34. title Exe blocker %count% Files found
  35. echo. Number of files found with .exe extention: %count%
  36. echo.
  37. echo.
  38. set add2=
  39.  
  40. CHOICE /C YN /M "Do you want to add aditional information?"
  41. IF Errorlevel 2 goto block
  42. IF Errorlevel 1 goto ADD
  43.  
  44. ::-----------------ADD additional info---------------
  45. :ADD
  46. Set /p add=Please type the additonal information for the name:
  47. Set add2=%add%
  48.  
  49. ::-----------------Add files to firewall--------------
  50. :block
  51. cls
  52. title Exe blocker - Blocking Rules
  53. set /a countt=0
  54. echo.
  55. echo.___________________________________________
  56. echo. Inbound Rules
  57. echo.___________________________________________
  58. FOR /r %%B in (*.exe) do (set /a countt+=1 & echo.%countt%. %%~nxB blocking... & netsh advfirewall firewall add rule name="%add2%%%~nxB" dir=in action=block program="%%~dpfnxB")
  59. echo.___________________________________________
  60. echo. OutBound rules
  61. set /a coun=0
  62. echo.___________________________________________
  63. FOR /r %%B in (*.exe) do (set /a coun+=1 & echo.%coun%. %%~nxB blocking... & netsh advfirewall firewall add rule name="%add2%%%~nxB" dir=out action=block program="%%~dpfnxB")
  64. echo.___________________________________________
  65. Echo. Added files to Firewall
  66. echo.
  67. title Exe blocker - Rules Blocked
  68. Pause
  69.  
  70. ::------------------------END---------------------
  71.  
  72. :END
  73. cls
  74. ECHO.
  75. Echo. Thanks for using .exe blocker
  76. Echo.
  77.  
  78. CHOICE /C YN /T 10 /D n /M "Do you want to open firewall? (10 seconds)"
  79. IF Errorlevel 2 goto EXIT
  80. IF Errorlevel 1 goto OPEN
  81.  
  82. ::------------------Open Firewall---------------
  83. :OPEN
  84. start "C:\Windows\System32" rundll32.exe shell32.dll,Control_RunDLL firewall.cpl
  85. Goto EXIT
  86.  
  87.  
  88. :EXIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement