Windows 从命令行启用/禁用防火墙 |
您所在的位置:网站首页 › win10关防火墙服务 › Windows 从命令行启用/禁用防火墙 |
可以使用netsh命令从命令行启用/禁用 Windows 防火墙。 Windows 10 / Windows 8/ Windows 7 / Server 2008 /Vista:让我们看看netsh advfirewall在这些 Windows 版本上配置防火墙的语法。3 个网络(域、专用、公共)的防火墙设置各不相同。因此,根据您要启用/禁用的网络防火墙,命令会有所不同。 您可以使用以下命令为当前网络配置文件(无论是域/私有/公共网络)打开防火墙。 netsh advfirewall set currentprofile state on关闭当前配置文件的防火墙: netsh advfirewall set currentprofile state off这些命令应该从提升的管理员命令提示符运行。否则你会得到以下错误。 C:\>netsh advfirewall set currentprofile state on The requested operation requires elevation (Run as administrator).要为特定网络配置文件启用/禁用防火墙,您可以使用以下命令。 域网络 打开域网络防火墙: netsh advfirewall set domainprofile state on关闭域网络防火墙: netsh advfirewall set domainprofile state off专用网络 开启私网防火墙: netsh advfirewall set privateprofile state on关闭私网防火墙: netsh advfirewall set privateprofile state off公共网络 开启公网防火墙: netsh advfirewall set publicprofile state on关闭公网防火墙: netsh advfirewall set publicprofile state off为所有网络配置 为所有网络打开防火墙 netsh advfirewall set allprofiles state on关闭所有网络的防火墙 netsh advfirewall set allprofiles state off 较旧的 Windows 版本 – XP / Server 2003:下面是打开防火墙的命令。 netsh firewall set opmode mode=ENABLE关闭防火墙的命令是: netsh firewall set opmode mode=DISABLE配置防火墙需要管理员权限,因此上述命令只能从管理员帐户运行。 netsh firewall 在新版本中已弃用。 在 Windows 10/8/7/Vista/Server 2008 中,' netsh firewall ' 命令打印如下消息。 c:\>netsh firewall set opmode mode=ENABLE IMPORTANT: "netsh firewall" is deprecated; use "netsh advfirewall firewall" instead. Though the command still works, it's preferable to use the new set of commands provided with netsh command. |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |