找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 3921|回复: 5

WIN7810防火墙配置批处理cmd命令

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

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

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

×
::使用管理员权限运行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 | 显示全部楼层
鼓掌,同意,支持
回复 点赞 拍砖

使用道具 举报

发表于 2020-7-27 09:17:41 | 显示全部楼层
顶一下,多谢分享
回复 点赞 拍砖

使用道具 举报

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

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-3-28 19:01 , Processed in 0.031965 second(s), 7 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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