- @echo off
- setlocal enabledelayedexpansion
- set /a "count=0,a=3,b=2,c=a+b"
- for /l %%i in (2,1,40) do (
- set /a count+=1
- if !count! leq !a! (
- title 开始ping 192.168.11.%%i 一次
- ping /n 1 192.168.11.%%i >nul 2>nul && echo 192.168.11.%%i ping入成功 || (
- title ping 192.168.11.%%i 一次失败,开始ping5次
- ping /n 5 192.168.11.%%i >nul 2>nul && echo 192.168.11.%%i ping入成功 || echo 192.168.11.%%i ping入失败
- )
- )
- if !count! equ !c! set count=0
- )
- pause&exit
复制代码
|