Solved

Batch file with Wait command between commands

Posted on 2008-10-31
3
2,160 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Expert Comment

by:Jholguin
ID: 22852633
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
ID: 22852750
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
ID: 22852762
"Sleep.exe" is part of the W2K3 Resource kit.
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

707 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