How to wait for x seconds on read host in Powershell? what I'm trying to achieve xis to prompt for user input for x seconds, if the user doesn't enter the value i needed. i use the default Value.
Currently when i use read-host its waiting on user input indefinitely, i want to have a timeout on it. how can i achieve this. the code i have is below. im unable to find any option that lets me define a timer on this.
$input = Read-Host ("Enter Y or N")
if(!input)
{
$input = Y
}
This is regarding possible duplicate question:
In that post all answers were directed more towards whether user pressed a key or not. they did not mention how to capture the user input in there to use it?