搜索
查看: 178|回复: 4

[其他] WIN7810防火墙配置批处理cmd命令

[复制链接]
发表于 2020-6-11 22:39:39 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册账号

x
::使用管理员权限运行cmd,拖上bat文件或复制内容运行


net start MpsSvc
::开启服务

::sc config MpsSvc start= auto
::开机启动

netsh advfirewall set allprofiles state on
::启用防火墙




netsh advfirewall firewall delete rule name="Allow Ping Damon" dir=in protocol=icmpv4 action=allow
netsh advfirewall firewall delete rule name="T1433" protocol=TCP dir=in localport=1433
netsh advfirewall firewall delete rule name="T4630" protocol=TCP dir=in localport=4630
netsh advfirewall firewall delete rule name="T4522" protocol=TCP dir=in localport=4522
netsh advfirewall firewall delete rule name="T9023" protocol=TCP dir=in localport=9023
netsh advfirewall firewall delete rule name="T11520" protocol=TCP dir=in localport=11520
netsh advfirewall firewall delete rule name="T211" protocol=TCP dir=in localport=211
netsh advfirewall firewall delete rule name="T8282" protocol=TCP dir=in localport=8282
netsh advfirewall firewall delete rule name="T5366" protocol=TCP dir=in localport=5366
netsh advfirewall firewall delete rule name="T80" protocol=TCP dir=in localport=80
netsh advfirewall firewall delete rule name="T3389" protocol=TCP dir=in localport=3389
netsh advfirewall firewall delete rule name="T8072" protocol=TCP dir=in localport=8072
netsh advfirewall firewall delete rule name="T1433" protocol=TCP dir=out localport=1433
netsh advfirewall firewall delete rule name="T4630" protocol=TCP dir=out localport=4630
netsh advfirewall firewall delete rule name="T4522" protocol=TCP dir=out localport=4522
netsh advfirewall firewall delete rule name="T9023" protocol=TCP dir=out localport=9023
netsh advfirewall firewall delete rule name="T11520" protocol=TCP dir=out localport=11520
netsh advfirewall firewall delete rule name="T211" protocol=TCP dir=out localport=211
netsh advfirewall firewall delete rule name="T8282" protocol=TCP dir=out localport=8282
netsh advfirewall firewall delete rule name="T5366" protocol=TCP dir=out localport=5366
netsh advfirewall firewall delete rule name="T80" protocol=TCP dir=out localport=80
netsh advfirewall firewall delete rule name="T3389" protocol=TCP dir=out localport=3389
netsh advfirewall firewall delete rule name="T8072" protocol=TCP dir=out localport=8072


netsh advfirewall firewall add rule name="Allow Ping Damon" dir=in protocol=icmpv4 action=allow
netsh advfirewall firewall add rule name="T1433" protocol=TCP dir=in localport=1433 action=allow
netsh advfirewall firewall add rule name="T4630" protocol=TCP dir=in localport=4630 action=allow
netsh advfirewall firewall add rule name="T4522" protocol=TCP dir=in localport=4522 action=allow
netsh advfirewall firewall add rule name="T9023" protocol=TCP dir=in localport=9023 action=allow
netsh advfirewall firewall add rule name="T11520" protocol=TCP dir=in localport=11520 action=allow
netsh advfirewall firewall add rule name="T211" protocol=TCP dir=in localport=211 action=allow
netsh advfirewall firewall add rule name="T8282" protocol=TCP dir=in localport=8282 action=allow
netsh advfirewall firewall add rule name="T5366" protocol=TCP dir=in localport=5366 action=allow
netsh advfirewall firewall add rule name="T80" protocol=TCP dir=in localport=80 action=allow
netsh advfirewall firewall add rule name="T3389" protocol=TCP dir=in localport=3389 action=allow
netsh advfirewall firewall add rule name="T8072" protocol=TCP dir=in localport=8072 action=allow

netsh advfirewall firewall add rule name="T1433" protocol=TCP dir=out localport=1433 action=allow
netsh advfirewall firewall add rule name="T4630" protocol=TCP dir=out localport=4630 action=allow
netsh advfirewall firewall add rule name="T4522" protocol=TCP dir=out localport=4522 action=allow
netsh advfirewall firewall add rule name="T9023" protocol=TCP dir=out localport=9023 action=allow
netsh advfirewall firewall add rule name="T11520" protocol=TCP dir=out localport=11520 action=allow
netsh advfirewall firewall add rule name="T211" protocol=TCP dir=out localport=211 action=allow
netsh advfirewall firewall add rule name="T8282" protocol=TCP dir=out localport=8282 action=allow
netsh advfirewall firewall add rule name="T5366" protocol=TCP dir=out localport=5366 action=allow
netsh advfirewall firewall add rule name="T80" protocol=TCP dir=out localport=80 action=allow
netsh advfirewall firewall add rule name="T3389" protocol=TCP dir=out localport=3389 action=allow
netsh advfirewall firewall add rule name="T8072" protocol=TCP dir=out localport=8072 action=allow
::常用端口


:echo off    旧版语法Win7&Win8.1测试无效
::netsh firewall set opmode mode = enable
::::启用防火墙

::netsh firewall set icmpsetting type=ALL mode=enable
::允许ICMP

::netsh firewall set service remotedesktop enable
::netsh firewall set portopening tcp 3389 enable


::远程桌面

@echo off
net start SessionEnv
net start TermService
::开启服务

sc config SessionEnv start= demand
sc config TermService start= demand
::开机手动启动


REG ADD "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
::开启选项

::netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow
::开启3389端口


发表于 2020-6-12 10:42:22 | 显示全部楼层
不错,不错,有参考价值。
回复 支持 反对

使用道具 举报

发表于 2020-6-13 11:49:14 | 显示全部楼层
不错,win10家庭版和专业版有什么需要特别注意的吗
回复 支持 反对

使用道具 举报

发表于 2020-6-28 13:49:52 | 显示全部楼层
home版可能需要加上提权语句。
回复 支持 反对

使用道具 举报

发表于 2020-6-29 23:58:20 | 显示全部楼层
鼓掌,同意,支持
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号 ) 川公网安备 51072502110008号

GMT+8, 2020-7-11 01:01 , Processed in 0.013196 second(s), 8 queries , Redis On.

Powered by Discuz! X3.4

Copyright © 2005-2020.

快速回复 返回顶部 返回列表