Solved

Timeout in a batch file

Posted on 2003-10-22
4
2,555 Views
Last Modified: 2013-12-28
I am writing a batch file to stop and start services on an NT Server. I want to pause for about ten seconds after I stop it in the batch file to ensure that it has enough time to stop before the batch file tries to start it again. Any ideas???
0
Comment
Question by:darbo
4 Comments
 
LVL 16

Expert Comment

by:_nn_
ID: 9605045
If you don't have any RK tool, just use :

ping -n 11 127.0.0.1 >NUL
0
 
LVL 83

Accepted Solution

by:
oBdA earned 50 total points
ID: 9605564
An absolute pause is not necessarily long enough.
If you're using the "net start" and "net stop" command, there's no need for it anyway; those commands give the control back only after they're finished.
If you're using sc.exe, which returns immediately, you'll need to query the status of the service and wait until it's properly shutdown.
What is your current situation (and do you have the Resource Kit)?
0
 
LVL 41

Expert Comment

by:graye
ID: 9606023
Use the Timeout.exe command from the Win2k Resource Kit... it will do what you want
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 9649224
You can certainly schedule net stop/net start using the AT command as well, if it is to be used at the same time.   Otherwise, RK contains SOON which will schedule the job out for a few seconds to several minutes, if that's what you're looking for (although I don't find that this works very well across timezones).
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now