发布网友 发布时间:2022-04-23 19:51
共1个回答
热心网友 时间:2023-10-06 03:36
复制粘贴到记事本,另存为xx.bat,编码选ANSI@echo off
rem ping指定网址,获取对应的IP地址以及连接的通断情况
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
set "host=www.baidu.com"
ping -w 15 -n 2 "%host%" >"%tmp%\t.t"
set "ip="
set "state=NO"
type "%tmp%\t.t"|>nul find /i "TTL="&&(set "state=OK")
for /f "tokens=2 delims=[]" %%a in ('type "%tmp%\t.t"^|findstr /ir /c:"Pinging .*\[[0-9\.]*\]" /c:"正在 Ping .*\[[0-9\.]*\]"') do (
set ip=%%a
)
echo;ip=%ip% [%state%]
echo;%#% +%$%%$%/%@% %z%
pause
exit