- @echo off
- for /l %%a in (0,1,254) do (
- for /l %%b in (1,1,254) do (
- ping -n 1 169.254.%%a.%%b | find /i "TTL"
- if %ERRORLEVEL% == 0 telnet 169.254.%%a.%%b 22
- )
- )
复制代码 试了一下好像不行,又想了一个if的方法- @echo off
- set a=0
- set b=1
- :ping
- ping -n 1 169.254.%a%.%b% | find /i "TTL"
- if %ERRORLEVEL% == 0 telnet 169.254.%a%.%b% 22
- set /a b+=1
- if %a% equ 254 (if %b% equ 254 exit)
- if %b% equ 254 (set /a a+=1 & set b=1)
- goto :ping
复制代码 试了下,可以实现。 |