Friday, December 6, 2013

Pause PowerShell script until key press

These 2 lines pause a PS1 script until the user presses a key. Fully mimics Windows/DOS pause command.

Write-Host -NoNewline "Press any key to continue . . . "
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

No comments:

Post a Comment