Solved

Timeout in a batch file

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

705 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

21 Experts available now in Live!

Get 1:1 Help Now