#关闭防火墙
netsh firewall set opmode mode=disable
#放行远程8888端口进来的流量
netsh advfirewall firewall add rule name="88" protocol=TCP dir=in remoteport=8888 action=allow
#放行出去到远程8888端口的流量
netsh advfirewall firewall add rule name="88" protocol=TCP dir=out remoteport=8888 action=allow
#放行本地4444端口出去的流量
netsh advfirewall firewall add rule name="44" protocol=TCP dir=out localport=4444 action=allow
#放行从本地4444端口进来的流量
netsh advfirewall firewall add rule name="44" protocol=TCP dir=in localport=4444 action=allow
#删除规则
netsh advfirewall firewall delete rule name="88"
#查看防火墙配置(可看到具体规则等配置)
netsh firewall show config
#关闭windefebd
net stop windefend
#打开445端口
netsh firewall set portopening TCP 445 ENABLE
#开放终端
netsh firewall set portopening TCP 3389 ENABLE
#删除放行程序A.exe
netsh firewall delete allowedprogram C:/A.exe
#添加程序C盘下的A.exe并放行
netsh firewall set allowedprogram C:/A.exe test ENABLE
#添加程序C盘下的A.exe并放行
netsh firewall add allowedprogram C:/A.exe test ENABLE
标签:exe,netsh,windows,防火墙,TCP,命令,add,放行,firewall
From: https://www.cnblogs.com/o-O-oO/p/18315621