0% found this document useful (0 votes)
13 views2 pages

Folder Block 6

This batch script creates firewall rules to block all executable (.exe) and dynamic link library (.dll) files in the current directory and its subfolders. It requires administrator permissions to run and prompts the user for confirmation before proceeding. The script also includes color-coded text output for better visibility and user interaction.

Uploaded by

810cdc22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Folder Block 6

This batch script creates firewall rules to block all executable (.exe) and dynamic link library (.dll) files in the current directory and its subfolders. It requires administrator permissions to run and prompts the user for confirmation before proceeding. The script also includes color-coded text output for better visibility and user interaction.

Uploaded by

810cdc22
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

:: v6

@echo off
REM
REM
cls
net session >nul 2>&1
if %errorLevel% == 0 (
echo.
) else (
GOTO :NOPERM
)
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do
rem"') do (
set "DEL=%%a"
)
@cd /d "%~dp0"
for %%* in (.) do set RULENAME=%%~nx*
ECHO|set /p ="- Add "
call :ColorText 0a "Block In & Out "
ECHO Firewall rules for all *.exe ^& *.dll files
ECHO.
ECHO|set /p = "- located at '"
call :ColorText 0b "%CD%'"
ECHO (inc subfolders)
ECHO.
ECHO|set /p = "- creating "
call :ColorText 1b "%RULENAME%"
ECHO as the Firewall rule name ?
ECHO.
ECHO.
ECHO.
ECHO Press any key to continue or CTRL+C to terminate now ...
pause >nul
cls
Echo.
FOR /r %%G in ("*.exe") Do (@echo %%G
NETSH advfirewall firewall add rule name="%RULENAME%-%%~nxG" dir=in program="%%G"
action="block" enable="yes")
FOR /r %%G in ("*.exe") Do (@echo %%G
NETSH advfirewall firewall add rule name="%RULENAME%-%%~nxG" dir=out program="%%G"
action="block" enable="yes")
FOR /r %%G in ("*.dll") Do (@echo %%G
NETSH advfirewall firewall add rule name="%RULENAME%-%%~nxG" dir=in program="%%G"
action="block" enable="yes")
FOR /r %%G in ("*.dll") Do (@echo %%G
NETSH advfirewall firewall add rule name="%RULENAME%-%%~nxG" dir=out program="%%G"
action="block" enable="yes")
Echo.
call :ColorText 0a "done"
ECHO|set /p =" ... Goodbye"
ECHO.
ECHO.
ECHO Press a key to exit ...
pause >nul
goto :eof

:ColorText
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
goto :eof

:Finish
Echo.
Echo.
Echo Batch ended...
Goto :END

:NOPERM
ECHO.
ECHO - You must run this file in Administrator mode
ECHO.
ECHO.
ECHO.
ECHO|SET /p ="- Press any key to exit ..."
Pause >NUL
ECHO goodbye
ECHO.
ECHO.
:END

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy