1 查看防火墙状态
netsh advfirewall show allprofiles
2 开启防火墙
netsh advfirewall set allprofiles state on
3 关闭防火墙
netsh firewall set opmode mode=disable
netsh advfirewall set allprofiles state off
用DOS命令关闭Windows自带防火墙
net stop sharedaccess
4 恢复初始防火墙设置
netsh advfirewall reset
5 设置默认输入和输出策略
允许
netsh advfirewall set allprofiles firewallpolicy allowinbound,allowoutbound
拒绝
netsh advfirewall set allprofiles firewallpolicy blockinbound,blockoutbound