查看防火墙配置
netsh firewall show config
允许指定程序全部连接(Windows Server 2003 系统及之前版本)
netsh firewall add allowedprogram c:\nc.exe "allow nc" enable
允许指定程序连入(Windows Server 2003 之后系统版本)
netsh advfirewall firewall add rule name="pass nc" dir=in action=allow program="C:\nc.exe"
允许指定程序连出
netsh advfirewall firewall add rule name="Allow nc" dir=out action=allow program="C:\nc.exe"
允许 3389 端口放行
netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow
Windows Server 2003 系统及之前版本关闭防火墙
netsh firewall set opmode disable
Windows Server 2003 系统之后版本关闭防火墙
netsh advfirewall set allprofiles state off