尝试从 netsh 防火墙阻止端口 Windows 防火墙

Trying to block port Windows Firewall from netsh firewall

我正在尝试创建一个 Windows 防火墙规则来阻止来自 netsh 防火墙的特定端口。

我正在查看以下文档:https://technet.microsoft.com/en-us/library/cc771920(v=ws.10).aspx

我尝试过的:

add portopening protocol=all port=12345 name="Tes1" mode=enable scope=all profile=all

问题是在“常规”选项卡->“操作”中我看到 "Allow the connection",如何将操作设置为 "Block the connection"?

谢谢。

netsh firewall 已弃用,请使用 netsh advfirewall firewall 代替,如下所示:

netsh advfirewall firewall add rule name="Block12345" protocol=TCP dir=in localport=12345 action=block

您可以在以下位置阅读相关内容:https://technet.microsoft.com/en-us/library/dd734783(v=ws.10).aspx