- @echo off
- setlocal enabledelayedexpansion
- set /p "str1=请输入第1个ip地址:"
- set /p "str2=请输入第2个ip地址:"
- set /p "str3=请输入第3个ip地址:"
- set m=0
- set n=0
- :S
- ping -n 1 !str1!>nul || echo !str1!不通 && echo !str1! !time! 不通>>1.txt && set /a m+=1
- echo !m!
- if !m! neq "0" (
- ping -n 1 !str2!>nul || echo !str2!不通 && echo !str2! !time! 不通>>2.txt && set /a n+=1
- )
- echo !n!
- if !n! neq "0" (
- ping -n 1 !str3!>nul || echo !str3!不通 && echo !str3! !time! 不通>>3.txt
- )
-
- goto S
复制代码
|