Pause and display the message "Press Enter to continue..."
When the pause command is run, PowerShell will display the message "Press Enter to continue..." and then halt any further execution until the user presses the ENTER key on the keyboard.
In Windows CMD the PAUSE command displays the message "Press any key to continue . . ."
This can be more convenient as it will work with the space bar and many other keys.
The "any key" message is slightly misleading because not every key will work to continue: Ctrl, Shift, Win,Alt
An alternative PowerShell PAUSE command, which behaves more like the CMD PAUSE:
PS C:\> [void][System.Console]::ReadKey($FALSE)
Alternatively as performance/speed is unlikely to be an issue, you can just call CMD:
PS C:\> CMD /c PAUSE
“Now at the close of this soft summer's day, Inclined upon the river's flowery side,
I pause to see the sportive fishes play, And cut with finny oars the sparkling tide” ~ Thomas Forster's Perennial Calendar.
Exit-PSSession - Exit PowerShell (or exit a script)
Pause script with configurable response keys via AdamsTech.