- @echo off
- set info=互助互利,支付宝扫码头像,感谢赞助
- rem 有问题,可加QQ956535081及时沟通
- title %info%
- cd /d "%~dp0"
- set "文本=IP.txt"
- set 响应时间=20
- set 数据包=10
- set 进程=5
- set "结果1=lost.txt"
- set "结果2=offline.txt"
- set "结果3=latency.txt"
- set "结果4=ok.txt"
- del /a /f /q "%结果1%" "%结果2%" "%结果3%" "%结果4%" 2>nul
- set "folder=%tmp%\log"
- rd /s /q "%folder%\" 2>nul
- md "%folder%\" 2>nul
- for /f "tokens=1,2* delims=: " %%a in ('type "%文本%"^|findstr /n .') do (
- echo;%%a %%b %%c
- set s=%%a
- (echo;@echo off
- echo;setlocal enabledelayedexpansion
- echo;title _@#@_["%%a %%b %%c"]
- echo;^>"%%tmp%%\#%%a.log" ping /n %数据包% %%c
- echo;for /f %%%%i in ^('type "%%tmp%%\#%%a.log"^^^|find /i /c "ttl="'^) do set n=%%%%i
- echo;if %%n%% equ 0 ^(
- echo; ^>"%folder%\#%%a.log" echo;2^^^|%%a %%b %%c
- echo;^) else ^(
- echo; for /f "tokens=3 delims=," %%%%i in ^('findstr /rc:"丢失 = [0-9]" "%%tmp%%\#%%a.log"'^) do set lost=%%%%i
- echo; for /f "tokens=3 delims=," %%%%i in ^('findstr /rc:"平均 = [0-9]" "%%tmp%%\#%%a.log"'^) do set average=%%%%i
- echo; if %%n%% lss %数据包% ^(
- echo; ^>"%folder%\#%%a.log" echo;1^^^|%%a %%b %%c ^!lost^! ^!average^!
- echo; ^) else ^(
- echo; for /f "tokens=3 delims=m " %%%%i in ^("!average!"^) do (
- echo; if %%%%i gtr %响应时间% ^(
- echo; ^>"%folder%\#%%a.log" echo;3^^^|%%a %%b %%c ^!lost^! ^!average^!
- echo; ^) else ^(^>"%folder%\#%%a.log" echo;4^^^|%%a %%b %%c ^!lost^! ^!average^!^)
- echo; ^)
- echo; ^)
- echo;^)
- echo;exit)>"%tmp%\#%%a.bat"
- start /min "" "%tmp%\#%%a.bat"
- call :circl
- )
- :wait
- tasklist /fi "IMAGENAME eq cmd.exe" /V /FO CSV|>nul find /i /c "_@#@_"&&(>nul ping /n 2 0 & goto wait)
- cls
- setlocal enabledelayedexpansion
- for /l %%a in (1 1 %s%) do (
- if exist "%folder%\#%%a.log" (
- for /f "tokens=1* delims=|" %%b in ('type "%folder%\#%%a.log"') do (
- >>"!结果%%b!" echo;%%c
- if %%b neq 4 (echo;%%c)
- )
- )
- )
- endlocal
- echo;%info%
- pause
- exit
- :circl
- set cout=0
- >nul ping /n 1 0
- for /f %%a in ('tasklist /fi "IMAGENAME eq cmd.exe" /V /FO CSV^|find /i /c "_@#@_"') do set cout=%%a
- title %info% - 当前进程数[%cout%]
- if %cout% geq %进程% (goto :circl)
- goto :eof
复制代码
|