Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Mimics the command prompt Pause command.
Mimics the command prompt Pause command.
Powershell doesn't have a Pause command that Prompts the user with "Press any key to continue..." and waits for a response.
This brings that command to PowerShell and allows you to customize the message.
The paused Message can be customzied by passing a string.
Pause "Waiting for you ..."
function Pause
HelpMessage = "The paused Message can be customzied."
[string] $Message="Press any key to continue..."
Write-Host -NoNewLine $Message
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.