Solved

Batch file with Wait command between commands

Posted on 2008-10-31
3
2,124 Views
Last Modified: 2012-06-21
I want to remotely restart a bunch of computers, but I do not want them all to reboot at the same time. I have a batch file below that i want to insert a WAIT command, so that the batch file will execute a command on one line, wait maybe 5 minutes, then go to the next line execute the command, wait 3 minutes, execute the command, etc.

what is the command i will put after each line to tell the batch to wait before moving to the next line?
shutdown -m \\servername1 -r -f

shutdown -m \\servername2 -r -f

shutdown -m \\servername3 -r -f

shutdown -m \\servername4 -r -f

shutdown -m \\servername5 -r -f

shutdown -m \\servername6 -r -f

shutdown -m \\servername7 -r -f

Open in new window

0
Comment
Question by:thesurg3on
  • 2
3 Comments
 

Expert Comment

by:Jholguin
Comment Utility
I had a situation where I needed to add a delay to a batch file as well and I used ping for X number of seconds:

ping -n X 127.0.0.1 > NUL

so for 5 minutes just add 300 for X and you're good to go.
0
 
LVL 4

Accepted Solution

by:
keamo earned 500 total points
Comment Utility
Can you try the "sleep" command...?

C:\>sleep
Usage:  sleep      time-to-sleep-in-seconds
        sleep [-m] time-to-sleep-in-milliseconds
        sleep [-c] commited-memory ratio (1%-100%)
0
 
LVL 4

Expert Comment

by:keamo
Comment Utility
"Sleep.exe" is part of the W2K3 Resource kit.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

10 Experts available now in Live!

Get 1:1 Help Now