检查 Windows 防火墙是否开启
一条 netsh 命令显示域、专用、公用三个防火墙配置文件的开关状态。
运行 `netsh advfirewall show allprofiles state`,三个配置文件(Domain、Private、Public)都应显示 ON。
01命令
命令
$ netsh advfirewall show allprofiles state02作用说明
Windows 有三套防火墙配置文件,当前生效的一套取决于网络类别;恶意软件和某些"优化工具"会偷偷把它们关掉。这条命令可以一次性打印三者的状态。若发现被关闭,运行 `netsh advfirewall set allprofiles state on` 即可全部重新开启。
03风险
!注意: 不要为了"解决"某个软件问题而关闭防火墙——应该创建针对性的放行规则,直接关闭会让所有开放端口暴露在外。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Get-NetFirewallProfile依据: Returns Domain, Private and Public firewall profiles with their Enabled state.
- netsh依据: Documents netsh WLAN commands including `netsh wlan show profile name=... key=clear` and `netsh wlan delete profile name=...`.
最后验证: 2026-09-18 · 分类: 安全与隐私