批处理wmic实现简单的 ping
代码比较简单pinger.bat[code]
@echo off
for /f "skip=1 tokens=1,2,3,4 delims= " %%a in (
'wmic path win32_pingstatus where "address='%1'" get protocoladdress^,buffersize^,responsetime^,responsetimetolive'
) do (
set temp_=%%c
if defined temp_ (
echo.&echo.Pinging %1 with %%a bytes of data:
echo.&echo.Reply from %%b Bytes=%%a Time=%%c TTL=%%d
) else (
echo.&echo.Ping request could not find host %1.Please check the name and try again.
)
)
exit /b[/code] wmic还真是万用啊...
回复 2楼 的帖子
呵呵,在微软的脚本中心转悠了一下午,就得到这一点点... win32_pingstatus回复 3楼 的帖子
script_center 那个都是英文吧,小弟我看都看不出来呀,wmic英语更多,于是闪开。回复 4楼 的帖子
呵呵,我有GOOGLE翻译...没想到的是 win32_pingstatus这东西还能将域名翻译成IP! wmi版的ping,与ping.exe应该是一个原理,当然都要将域名解析成IP
页:
[1]