Solved

Timeout in a batch file

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Learn how to PXE Boot both BIOS & UEFI machines with DHCP Policies and Custom Vendor Classes
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
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…

749 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