vieyahn2017 / shellv

shell command test and study
4 stars 1 forks source link

2.18 【bat】ip连通性检测 #78

Open vieyahn2017 opened 2 years ago

vieyahn2017 commented 2 years ago
rem ping测试,需要一个ip.txt的附件提供ip列表
@echo off
for /f %%i in (ip.txt) do (
ping -n 2 -w 300 %%i > nul
if ERRORLEVEL 1 ( echo %%i unreachable ) else echo %%i reachable
)
pause
vieyahn2017 commented 2 years ago
rem ping test, need ip.txt

@echo off
for /f %%i in (ip.txt) do (
    (ping -n 2 -w 300 %%i  | find  "TTL"   > nul)  &&  echo %%i reachable || echo %%i unreachable
)

pause
vieyahn2017 commented 2 years ago
rem ping test, need ip.txt

@echo off
for /f %%i in (ip.txt) do (
    ping -n 2 -w 300 %%i > nul
    if ERRORLEVEL 1 (
        echo %%i unreachable
    ) else (
        (curl -k -s https://%%i/login.html | find "html"  > nul)  &&  echo %%i web reachable || echo %%i reachable but web unreachable
    )
)
pause