本帖最后由 yu2n 于 2013-1-30 13:47 编辑
是要获取局域网所有IP状态?
参考:- cls & @echo off
- FOR /F "tokens=15" %%i in ('ipconfig /all ^| find /i "IP Address"') do (
- FOR /F "tokens=1,2,3,* delims=." %%a in ("%%i") do (
- Set SubNet=%%a.%%b.%%c
- )
- )
- For /L %%i in (1,1,254) do (
- title ping -w 50 -n 1 %SubNet%.%%i
- (
- ping -w 50 -n 1 %SubNet%.%%i|find /i "Reply from" >nul && (
- echo %SubNet%.%%i OnLine
- echo %SubNet%.%%i OnLine>>"%SubNet%.xls.txt"
- ) || (
- echo %SubNet%.%%i Miss
- echo %SubNet%.%%i Miss>>"%SubNet%.xls.txt"
- )
- )
- )
- pause
复制代码
|