This PowerShell script waits for a key press or counts down from a specified timeout, displaying the countdown in-place. If a key is pressed during the countdown, the script exits immediately.
Wait-ForKeyOrTimeout.ps1.mp4
Wait-ForKeyOrTimeout -Timeout 10
This will display a message counting down from 10 seconds, updating in-place, and will exit immediately if a key is pressed during the countdown.
- Timeout: The number of seconds to count down from (default is 10).