batch file to constantly ping

Hi,
I restart a remote system pretty frequently and I need to know when it comes back online. To do this, I open a dos prompt and type in the command below.  It just pings the machine.  I have tried to put this in a .bat file, but it keeps opening several windows.  How can I make a file that I can double click to open a new dos prompt and keep pinging my machine?


ping v-mymachine /t
jackjohnson44Asked:
Who is Participating?
 
KimputerConnect With a Mentor Commented:
It's because you named your batch file ping.bat (resulting in a loop).
Give it ANY other name, and should work as want.
0
 
WORKS2011Connect With a Mentor Austin Tech CompanyCommented:
echo off
ping -t ipaddress
0
 
WORKS2011Austin Tech CompanyCommented:
For my own sake of understanding how does renaming the file make a difference?

Thank you
0
 
KimputerCommented:
He named the batch file ping.bat
Inside it calls the same batch file again. You think it will call the internal ping command, but the batch file named ping takes precedence and loop begins. Each time calling itself and keep opening more and more windows.
Calling the file anything else will actually start real ping command.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.