Wait 20 seconds in a batch file
Taboujr
Posted messages
507
Status
Membre
-
bustvhk -
bustvhk -
Hello!
I need a little help. I have a batch file that runs at startup on the server and sends a message to the two other PCs on the network to let them know that the server has rebooted (since it doesn't have a screen, it's the only solution we found...).
The problem is that when the client PCs receive the messages, the server’s network services aren’t launched yet. Based on that, if we put a 20-second pause before sending the messages in the batch, would that be enough? And if so, how would you put a 20-second pause in a batch file?
Thanks in advance.
Tabou Junior
I need a little help. I have a batch file that runs at startup on the server and sends a message to the two other PCs on the network to let them know that the server has rebooted (since it doesn't have a screen, it's the only solution we found...).
The problem is that when the client PCs receive the messages, the server’s network services aren’t launched yet. Based on that, if we put a 20-second pause before sending the messages in the batch, would that be enough? And if so, how would you put a 20-second pause in a batch file?
Thanks in advance.
Tabou Junior
9 réponses
Hi,
another solution you can use is the SLEEP command..
you can do a "SLEEP 20" and it will pause for 20 seconds
I can send it to you if you want because I don't remember where I downloaded or found it!!
another solution you can use is the SLEEP command..
you can do a "SLEEP 20" and it will pause for 20 seconds
I can send it to you if you want because I don't remember where I downloaded or found it!!
Good night,
yes choice will work if you write it with the following syntax:
choice /c:ON /n /t:O,20
where /n suppresses the display (Y/N) of the letters designated by /C:
and /t: gives the default result O (Yes) in 20 seconds.
The command and its switches are valid from DOS versions 6 to 8 (and ?? ...).
Olivier Fournier
yes choice will work if you write it with the following syntax:
choice /c:ON /n /t:O,20
where /n suppresses the display (Y/N) of the letters designated by /C:
and /t: gives the default result O (Yes) in 20 seconds.
The command and its switches are valid from DOS versions 6 to 8 (and ?? ...).
Olivier Fournier
Otherwise, a little ping allows you to wait a bit.
For example:
where '-n 5' is the duration of each ping. If you want to wait 20 seconds, I recommend
For example:
ping -n 5 127.0.0.1
where '-n 5' is the duration of each ping. If you want to wait 20 seconds, I recommend
ping -n 15 127.0.0.1 or... ping -n 20 127.0.0.1
It's not really the most appropriate command, but it does allow for a pause... The CHOICE command
http://1100f.free.fr/Batchs/la_commande_choice.htm
If the user does not respond, a default signal is sent to execute the script. I hope it will be okay.
Patapi Biribibi Rabada dada
Dada dada !!
http://1100f.free.fr/Batchs/la_commande_choice.htm
If the user does not respond, a default signal is sent to execute the script. I hope it will be okay.
Patapi Biribibi Rabada dada
Dada dada !!
Well, I know this topic is a bit old (a lot), but it can be useful for those looking for a solution.
In Windows 7, there is the timeout command to add a pause.
timeout /? for more info.
In Windows 7, there is the timeout command to add a pause.
timeout /? for more info.
I don't agree with you!! because ping also works without a network card like mine ;)
for 4 seconds: (n-1) ==> the n in this example is equal to 5
ping -n 5 127.0.0.1
or
ping -n 5 localhost
PING /?
Usage: ping [-t] [-a] [-n echoes] [-l size] [-f] [-i ttl] [-v TypeServ]
[-r Hops] [-s Hops] [[-j HostsList] | [-k HostsList]]
[-w Timeout] TargetName
Options:
-t Sends the ping request to the specified host until
interrupted.
Press Ctrl-Break to display statistics and continue,
Ctrl-C to stop.
-a Resolves hostnames from addresses.
-n echoes Number of echo requests to send.
-l size Sends the size of the buffer.
-f Sets the Don't Fragment flag in the packet.
-i ttl Time to live.
-v TypeServ Type of service.
-r Hops Records the route for the number of hops.
-s Hops Timestamp for the number of hops.
-j HostsList Loose source route along the host list.
-k HostsList Strict source route along the host list.
-w Timeout Timeout for each reply, in milliseconds.
-w Waiting time for each response, in milliseconds.
That's it for your point 1: it's reliable.
Yes ping = poop
Use the command TIMEOUT /t 30 /NOBREAK
here in the example, a pause of 30 seconds