netsh advfirewall firewall
为本地端口 添加进站允许规则
netsh advfirewall firewall add rule name = SQLPort1433 dir = in protocol = tcp action = allow localport = 1433 remoteip = localsubnet profile =any
为本地端口 添加出站允许规则
netsh advfirewall firewall Add rule name="www80" dir=out protocol=tcp localport=80 action=allow
也可以写为UDP 或者多个PORT
netsh advfirewall firewall Add rule name="OPEN PORT " dir=out protocol=udp localport=5000-5010 action=allow