How to create a delay in a batch file

Updated 8/31/2020

Below is an example of deferring a batch file. Since no timeout or sleep option is included with MS-DOS or Windows, we’ll use the command of our choice to implement a timeout.

Choices in Windows Vista, 7, 8 and 10

You can use the select command included with these versions of Windows to delay a batch file from 0 to 9999 seconds. In this example, we’re illustrating a five-second delay. If you want to increase or decrease this delay, change the value from “5”.

CHOICE /N /C YN /T 5 /DY >NUL

Using Choice in Windows XP and earlier and MS-DOS

You can delay a batch file from 0 to 99 seconds using the select command included with Windows XP and earlier versions. In this example, we’re illustrating a five-second delay. If you want to increase or decrease this delay, change the value from “5”.

Enter NULL | a CHOICE.COM /N /CY /TY,5 >NUL

  • For more information on each of these options, visit our order of choice page.

Third party sleep utility

You can also use the standby file found in our utility downloads section. Once the sleep file is downloaded, you can use this utility to sleep as many seconds as you want.

  Can you remove domain admins from the local admins group?