| | |
DOS Batch command to ping network IP
![]() |
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:
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.
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.
*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:
But how do I check for the reply, and pass it to the IF statement?
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
}
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.
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.
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.
![]() |
Other Threads in the Legacy and Other Languages Forum
- Previous Thread: Euphoria
- Next Thread: Lisp question
| Thread Tools | Search this Thread |






