I have a batch file that runs as a secheduled task in windows server 2003.

This batch file purely calls around 20 other batchfiles one after the other.

When this runs it causes quite a spike on the server and a reduction in performance.

I'd like the ability to add a WAIT or SLEEP type command between each of my batch file calls in order to spread the load out a bit.

Can anyone shed any light on the simplest way of doing this?

link|improve this question

46% accept rate
feedback

3 Answers

up vote 5 down vote accepted

The code you are looking for, looks like this:

ping -n 11 127.0.0.1 > NUL

The value after "-n" indicates the seconds to wait.
If you want to wait 10secs just add one more ping,
like shown in the example.

Best regards.

P.S.: If you use the powershell, there may be other ways to do this.

link|improve this answer
In PowerShell there is Start-Sleep for that, right :-) – Joey Oct 2 '09 at 16:41
feedback

There's a W2K3 resource kit utility called sleep.exe that you can use by calling it in the batch file and telling it how long to "sleep" before moving on to the next command.

Example:

net use X: \server\share /Delete

sleep 300

net use X: \server\share

link|improve this answer
feedback

The best way is to use 'ping', but you can find more ways here: http://drbatcher.blogspot.com/2009/10/pauses-and-delays-in-batch-scripts.html

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.