DOS Batch command to ping network IP

Reply

Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

DOS Batch command to ping network IP

 
0
  #1
Mar 27th, 2007
Hey, I'm a complete noob to batch commands. I just found that they might be somewhat useful for some stuff I'm doing, so I thought I'd try them out.

Anyway, I've got a batch file that calls a program called Poweroff to turn on a pc on my network via WOL (wake on lan).

Here is the code:
CLS
@ECHO ON
poweroff wol -ip 192.168.0.3 -subnet 255.255.255.0 -mac 0xxxx00xxxxx
call wait 90
CLS
EXIT

As you can see, I'm calling a script called wait.bat, that simply pauses the script for 90 seconds to make sure the box has come out of hibernate before I continue processing commands. But I would like it to be more efficient. Rather than just waiting 90 seconds, and then continuing on, I would like to ping 192.168.0.3, and wait till there is a reply, and then go on. That way I can make sure the box is up before continuing.

Anyone know how to check the ping reply to make sure it is getting a reply before continuing on?
Thanks.

edit: I replaced the MAC address for security purposes.
Last edited by nathanpacker; Mar 27th, 2007 at 8:31 pm.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: DOS Batch command to ping network IP

 
0
  #2
Apr 4th, 2007
*BUMP*
No ideas? Surely it's a simple solution. I've googled it to death but can't find anything. A batch command that could confirm whether a ping comes back successfully would be fairly useful, no? Say:

PING 192.168.0.3
IF Reply {
do this
}
else {
do this
}
But how do I check for the reply, and pass it to the IF statement?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 376
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: DOS Batch command to ping network IP

 
0
  #3
Apr 7th, 2007
>Surely it's a simple solution

I don't think so, I could only think of a way to get the status back using code i.e getProcessState. Unless someone knows better?
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: DOS Batch command to ping network IP

 
0
  #4
Apr 7th, 2007
Well thanks for the reply anyway. I think I might have something figured out. As soon as I do, I'll update this thread.
Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: DOS Batch command to ping network IP

 
0
  #5
May 13th, 2007
If you do a ping -t 192.168....

Then it will continue pinging until you hit CTL C - you will therefore see when it comes up and continue when you are ready.
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: DOS Batch command to ping network IP

 
0
  #6
May 13th, 2007
Originally Posted by DenisOxon View Post
If you do a ping -t 192.168....

Then it will continue pinging until you hit CTL C - you will therefore see when it comes up and continue when you are ready.
Yeah, that's great, except you can't do that in a batch script. Thanks for the idea though. I haven't had time to look further into this yet, but as soon as I do, I'll let you know how it goes.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 15,973
Reputation: jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all jbennet is a name known to all 
Solved Threads: 505
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Moderator

Re: DOS Batch command to ping network IP

 
0
  #7
May 13th, 2007
i suppose you could do it as a script instead of a batch file
If i am helpful, please give me reputation points.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: DOS Batch command to ping network IP

 
0
  #8
May 13th, 2007
Originally Posted by nathanpacker View Post
Yeah, that's great, except you can't do that in a batch script. Thanks for the idea though. I haven't had time to look further into this yet, but as soon as I do, I'll let you know how it goes.

Sorry I thought you saw it run, so you could cancel it
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 232
Reputation: nathanpacker is an unknown quantity at this point 
Solved Threads: 0
nathanpacker's Avatar
nathanpacker nathanpacker is offline Offline
Posting Whiz in Training

Re: DOS Batch command to ping network IP

 
0
  #9
May 13th, 2007
That's ok. Yeah, if and when I do it, it will be going in the middle of the night. But as of right now, I've kind of had to put it on hold.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 319
Reputation: DenisOxon is an unknown quantity at this point 
Solved Threads: 15
DenisOxon's Avatar
DenisOxon DenisOxon is offline Offline
Posting Whiz

Re: DOS Batch command to ping network IP

 
0
  #10
May 14th, 2007
As it will run in middle of night, if it always works with 90 seconds delay then I would go with that.

Just had a thought - when it is up and running can you test for the exstance of a file (have a file used as a marker file that is never deleted) If so you just keep testing for it. Make sure you have an 8.3 name for it.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Legacy and Other Languages Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC