Powershell- Wait for x seconds on read host -


how wait x seconds on read host in powershell? i'm trying achieve xis prompt user input x seconds, if user doesn't enter value needed. use default value.

currently when use read-host waiting on user input indefinitely, want have timeout on it. how can achieve this. code have below. im unable find option lets me define timer on this.

$input = read-host ("enter y or n")  if(!input) {    $input = y } 

this regarding possible duplicate question:
in post answers directed more towards whether user pressed key or not. did not mention how capture user input in there use it?


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -