关闭windows防火墙常用危险端口;


bat脚本如下:



@echo off
color E2
title 关闭常见的危险端口
echo 正在开启Windows防火墙
echo.
netsh advfirewall set currentprofile state on > nul
netsh advfirewall set publicprofile state on > nul
netsh advfirewall set allprofile state on > nul
netsh advfirewall set privateprofile state on > nul
echo.
echo 防火墙已经成功启动。
echo.
echo.
pause
cls
echo 正在关闭常见的危险端口,请稍候…
echo.
echo 正在关闭135,137,139,445端口…
netsh advfirewall firewall add rule name=denyDangerTCPPort dir=in protocol=TCP localport=135,137,139,445 action=block
echo 正在关闭137,138端口…
netsh advfirewall firewall add rule name=denyDangerUDPPort dir=in protocol=UDP localport=137,138 action=block

echo 常见的危险端口已经关闭。
echo.
echo.
echo.
echo.
echo.
echo.
echo 按任意键退出。
pause>nul



保存Txt文件注意修改一下格式选择UTF-8 否则会乱码;