Solved

Timeout in a batch file

Posted on 2003-10-22
4
2,553 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

Want to promote your upcoming event?

Attending an event? Speaking at a conference? Or exhibiting at a trade show? Easily inform your contacts by using a promotional banner in your email signature. This will ensure your organization’s most important contacts are in the know.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bulk Reorder File Names 4 56
Deploying Windows 10 in MDT 18 56
mac maintenance 6 34
Undelete of overwritten files 27 58
Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
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.
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

920 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

13 Experts available now in Live!

Get 1:1 Help Now