如果需要为应用程序添加一些例外,可以使用 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