Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ echo off
- @setlocal enableextensions
- @cd /d "%~dp0"
- color F0
- title Exe blocker
- echo.
- echo. ==============================
- echo. == Welcome to .exe blocker ==
- echo. ==============================
- echo.
- Echo Current location: %cd%
- echo.
- CHOICE /C YN /M "Do you want to search in the current location?"
- IF Errorlevel 2 goto END
- IF Errorlevel 1 goto Yes
- ::--------------------CHECK and searching files-----------------
- :Yes
- set location=%cd%
- cls
- echo.
- Echo. Searching for .exe files in %location%
- echo.
- set /a count=0
- echo.___________________________________________
- echo.Found:
- echo.
- FOR %%i in (*.exe) do (echo. %%i & set /a count+=1)
- echo.___________________________________________
- echo.
- title Exe blocker %count% Files found
- echo. Number of files found with .exe extention: %count%
- echo.
- echo.
- set add2=
- CHOICE /C YN /M "Do you want to add aditional information?"
- IF Errorlevel 2 goto block
- IF Errorlevel 1 goto ADD
- ::-----------------ADD additional info---------------
- :ADD
- Set /p add=Please type the additonal information for the name:
- Set add2=%add%
- ::-----------------Add files to firewall--------------
- :block
- cls
- title Exe blocker - Blocking Rules
- set /a countt=0
- echo.
- echo.___________________________________________
- echo. Inbound Rules
- echo.___________________________________________
- 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")
- echo.___________________________________________
- echo. OutBound rules
- set /a coun=0
- echo.___________________________________________
- 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")
- echo.___________________________________________
- Echo. Added files to Firewall
- echo.
- title Exe blocker - Rules Blocked
- Pause
- ::------------------------END---------------------
- :END
- cls
- ECHO.
- Echo. Thanks for using .exe blocker
- Echo.
- CHOICE /C YN /T 10 /D n /M "Do you want to open firewall? (10 seconds)"
- IF Errorlevel 2 goto EXIT
- IF Errorlevel 1 goto OPEN
- ::------------------Open Firewall---------------
- :OPEN
- start "C:\Windows\System32" rundll32.exe shell32.dll,Control_RunDLL firewall.cpl
- Goto EXIT
- :EXIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement