Advertisement
rerere284

Batch checking internet

Feb 22nd, 2024
1,255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.56 KB | None | 0 0
  1. @echo off
  2.  
  3. :promptUser
  4. set /p choice="Do you want to check DNS (nslookup) or perform a continuous ping (ping)? (n/p): "
  5. if /i "%choice%"=="n" goto checkDNS
  6. if /i "%choice%"=="p" goto pingLoop
  7. echo Invalid option. Please enter 'n' for nslookup or 'p' for ping.
  8. timeout /t 2 /nobreak >nul
  9. goto promptUser
  10.  
  11. :checkDNS
  12. echo Checking DNS...
  13. nslookup www.microsoft.com
  14. timeout /t 4 /nobreak >nul
  15. goto checkDNS
  16.  
  17. :pingLoop
  18. echo Performing continuous ping to www.microsoft.com...
  19. :ping
  20. ping -n 2 www.microsoft.com
  21. timeout /t 4 /nobreak >nul
  22. goto ping
  23.  
  24. pause >NUL
  25.  
Tags: ping
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement