Windows Firewall Wildcard
@echo off
REM BATCH FILE CREATED BY CHARLES DE HAVILLAND 20/02/2012
REM 20220422 lbr adapted from:
REM Windows Firewall Wildcard
REM https://www.itninja.com/question/windows-firewall-wildcard
REM
If "%1"=="" GOTO :norulename
SET RULENAME=%1
echo:Create in/out firewall rules for all *.exe files with the rulename of "%RULENAME%" ?
echo:
echo:
pause
echo:
FOR /r %%G in ("*.exe") Do (
@echo:%%G
NETSH advfirewall firewall add rule name="%RULENAME%-inp-%%~nxG" dir=in program="%%G" action="block" enable="yes"
NETSH advfirewall firewall add rule name="%RULENAME%-out-%%~nxG" dir=out program="%%G" action="block" enable="yes"
)
echo:
echo:done.
echo:
GOTO :Finish
:norulename
echo:Error! - You did not specify a Rulename as first parameter"
echo:
:Finish
echo:Batch ended...
No comments:
Post a Comment