联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
@echo off ping [url]www.yahoo.com.cn[/url] >%temp%\1.txt find "Ping statistics for" %temp%\1.txt >%temp%\2.txt for /f "skip=2 tokens=4" %%M in (%temp%\2.txt) do set IP_=%%M del %temp%\1.txt del %temp%\2.txt :: 去掉那个%IP_%最后那个冒号 setlocal ENABLEDELAYEDEXPANSION for /f "delims=" %%i in ("%IP_%") do ( set ip=%%i set "ip=!ip::=!" ) setlocal DISABLEDELAYEDEXPANSION echo %ip% pause
@echo off for /f "tokens=2 delims=[]" %%i in ('ping www.yahoo.com.cn /n 1 /w 0') do echo %%i pause