Advertisement
tei219

pingtest

Oct 5th, 2011
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. setlocal
  3. pushd %CD%
  4. cd /d %~d0%~p0
  5.  
  6. rem Usage:
  7. rem        pingtest.bat /failcheck servername
  8. rem        pingtest.bat /passcheck servername
  9. rem Requied:
  10. rem        bin\sleep.exe
  11.  
  12. if "%1"=="/failcheck" (
  13.     :FAILCHECK
  14.     bin\sleep.exe 5
  15.     (ping.exe 1>nul -n 1 %2  && echo [INFO] %2 still up. && goto :FAILCHECK) || (echo [INFO] past ping-failcehck. && goto :EOB)
  16. )
  17.  
  18. if "%1"=="/passcheck" (
  19.     :PASSCHECK
  20.     bin\sleep.exe 5
  21.     (ping.exe 1>nul -n 1 %2  && echo [INFO] past ping-passcheck. && goto :EOB) || (echo [INFO] %2 still down. && goto :PASSCHECK)
  22. )
  23.  
  24. :EOB
  25. popd
  26. endlocal
  27. rem pause
  28. goto :EOF
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement