The TIMEOUT command in batch script job results in "ERROR: Input redirection is not supported, exiting the process immediately.

Document ID : KB000029524
Last Modified Date : 14/02/2018
Show Technical Document Details

Issue: 

Like Linux and UNIX OS, Windows has 'SLEEP' command's equivalent called 'TIMEOUT'. However, when TIMEOUT is executed in background batch script, it will result in "ERROR: Input redirection is not supported, exiting the process immediately.". The TIMEOUT command will run perfectly well in a console or terminal session. 

Cause: 

When TIMEOUT is executed, it tries to redirect the input. The command waits for the user to interrupt the wait period. This is not possible if the command is executed in background. It does not have a possibility of getting any input and fails immediately.

Workaround:

There are many alternatives available on the net to sleep a job or script. A very commonly used one is to ping a loopback (127.0.0.1). Both ping and loopback adapter are available by default on every OS.

ping 127.0.0.1 -n1 -w 10000 >NUL
-n count Number of echo requests to send.
-w timeout Timeout in milliseconds to wait for each reply
NUL - designates a special file that discards all data written to it

Change the -w timing as per requirement.