Add a timeout between two batch command lines in Jenkins

In case you want to get rid of the error message from Yauheni Basalai's answer, try sending the stderr to stdout by adding >nul 2>&1

waitfor SomethingThatIsNeverHappening /t 100 >nul 2>&1

credit goes to http://brisray.com/computers/batch-delay.htm


You can use this:

PING 1.1.1.1 -n 1 -w 30000 >NUL

This send one ping attempt and waits 30 seconds for a response. Not sure why you're getting the "ERROR: Input redirection is not supported, exiting the process immediately." message but I actively use the command above regularly.


I think you can use the following command in Execute Windows batch command (will wait for 100 seconds):

waitfor SomethingThatIsNeverHappening /t 100 

This will return an error which could break your build. To avoid that, redirect the error output:

waitfor SomethingThatIsNeverHappening /t 100 2>NUL

I have encountered a similar problem with VSTS "command line" utility (v 2.*) which uses the cmd shell, and I have used the following (from elevated PowerShell session):

Add-Content c:\windows\sleep.cmd "call powershell -NoProfile -ExecutionPolicy ByPass -command sleep %1"