This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Wait-KeyPress

Synopsis

Waits (pauses the session) until a user presses a key. For use in scripts.

Syntax

  • Wait-KeyPress [-Message] [-Quiet]

Description

The Wait-KeyPress cmdlet pauses the Powershell session until the user presses a key.

Parameters

  • Message The message to display to the user. By default the message is "Press any key to continue..."
  • Quiet Do not display a message.

Inputs

Wait-KeyPress does not accept input objects.

Outputs

Wait-KeyPress does not output any Powershell objects.

Notes

The are no notes associated with the Wait-KeyPress cmdlet.

Example 1

This command will pause the current Powershell session with the message "Press any key to continue...":

C:\PS>Wait-KeyPress

Example 2

This command will pause the current Powershell session with the message "Hit a button to proceed...":

C:\PS>Wait-KeyPress -Message "Hit a button to proceed..."

Example 3

This command will will pause the current Powershell session without displaying a message to the user:

C:\PS>Wait-KeyPress -Quiet