有没有办法创建一个批处理来运行以下代码?我创建了批处理文件,但无法完成工作。
:Allow IPV4 Ping
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request"
protocol=icmpv4:8,any dir=in action=allow
Echo %errorlevel%
Pause
:Allow IPV6 Ping
netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request"
protocol=icmpv6:8,any dir=in action=allow
Echo %errorlevel%
Pause
netsh advfirewall firewall show rule name=all
Pause
答案1
如果只是想改变现有的规则,不需要使用“添加规则”
windows 10:netsh advfirewall 防火墙设置规则名称=“文件和打印机共享(Echo 请求 - ICMPv4-In)”新启用=yes