Technovangelist


I'm Matt Williams and I am an Evangelist at Datadog and an organizer for DevOps Days Boston. This site is a place where I write about the stuff that interests me.

How To Do a Real Pause in a Batch File On Windows

Posted on September 13, 2011

Ever wonder how to put a 20 second pause into a batch file on Windows? I had that problem today. I was setting up some virtual machines on a virtual machine hosting provider and needed a way to launch 2 virtual machines from a batch file. I knew that the Windows Server 2008 domain controller took 75 seconds to boot, and I didn’t want the member server to start until after the DC was completely up and running.

The command, PAUSE has been available to batch files forever, but it waits for an enduser to press a button before it continues. I want to just wait for a certain time interval. Well, it turns out there is another command available in Windows that does exactly what I needed. The command is TIMEOUT and I think it first showed up in Windows Vista. Add timeout /t 75 and your batch file will wait 75 seconds before it continues to the next step.

Perfect!