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

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

book

Article ID: 29524

calendar_today

Updated On:

Products

DSERIES- SERVER CA Workload Automation DE - System Agent (dSeries)

Issue/Introduction

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. 

Environment

Release: CAWAS999000-11.1-Workload Automation-Agent for Application Services
Component:

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.

Resolution

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.