转发:https://blog.csdn.net/2401_84084080/article/details/141118365
Win10 下, 测试有效。
# 开启ping功能(IPV4))
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
# 开启ping功能(IPV6)
netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol=icmpv6:8,any dir=in action=allow
# 禁止ping功能(IPV4)
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=block
# 禁止ping功能(IPV6)
netsh advfirewall firewall add rule name="ICMP Allow incoming V6 echo request" protocol=icmpv6:8,any dir=in action=block