• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 719
  • Last Modified:

Script commands to test Internet connection

Running Windows 7 Pro on HP z210.

I am battling my internet provider.  My connection disconnects frequently.
I have to keep entering the command:  ping www.yahoo.com to see if the connection has failed.
I am working with the vendor to determine if the problem can be solved or whether I have to find a new Internet vendor.

In the meantime...  I don't want to have to keep entering the ping command.
I am aware there is a robust scripting language for Windows 7.

Q1.) What commands would I put into a script to determine if the internet  connection has failed?

Q2.)  what script commands would execute an mp3 file if the connection has failed?
0
donpick
Asked:
donpick
2 Solutions
 
Dan CraciunIT ConsultantCommented:
ping www.yahoo.com -t

This will keep pinging yahoo.

HTH,
Dan
0
 
achaldaveCommented:
Try this, create .bat file, replace c:\temp\myfile.mp3 with path to mp3 file you want to play.

@setlocal enableextensions enabledelayedexpansion
@echo off
set target=%1

:testconnection

ping -n 1 !target! >nul: 2>nul:
if  !errorlevel!==0  (
    echo Response Recieved from !target!
   
) Else (
    echo Lost connection to !target!
start C:\temp\myfile.mp3
    goto :eof
)


goto :testconnection
endlocal
:eof
0
 
donpickAuthor Commented:
Thank you for your fast responses
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now