Created
February 4, 2015 00:11
-
-
Save VertigoRay/c72c157e25de39384c84 to your computer and use it in GitHub Desktop.
Mimics the command prompt Pause command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Mimics the command prompt Pause command. | |
.DESCRIPTION | |
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. | |
.PARAMETER Message | |
The paused Message can be customzied by passing a string. | |
.INPUTS | |
.OUTPUTS | |
.EXAMPLE | |
Pause | |
.EXAMPLE | |
Pause "Waiting for you ..." | |
.NOTES | |
.LINK | |
go.vertigion.com/PowerShell-Pause | |
#> | |
function Pause | |
{ | |
param( | |
[Parameter( | |
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