如果您需要为您的应用程序添加一些例外,您可以使用netsh 。
在命令行中写入(对于 XP):
netsh firewall add allowedprogram ?
在命令行中写入(对于 W7):
netsh advfirewall firewall add rule ?
这种差异是因为不推荐使用netsh firewall命令。相反,我们必须使用命令netsh advfirewall firewall。
有关使用命令 netsh advfirewall firewall 而不是 netsh firewall 命令的更多信息,我们可以在知识库中看到:http: //go.microsoft.com/fwlink/ ?linkid=121488
例子:
为没有对 messenger.exe 进行安全封装的传入流量添加规则:
netsh advfirewall firewall add rule name="allow messenger" dir=in program="c:\programfiles\messenger\msmsgs.exe" security=authnoencap action=allow
为端口 80 的传出流量添加规则:
netsh advfirewall firewall add rule name="allow80" protocol=TCP dir=out localport=80 action=block
通过端口 80 为 TCP 的入站流量添加安全和流量加密规则:
netsh advfirewall firewall add rule name="Require Encryption for Inbound TCP/80" protocol=TCP dir=in localport=80 security=authdynenc action=allow