September 21st, 2013

PowerTip: Use PowerShell to Send Beep to Console

Doctor Scripto
Scripter

Summary: Use the Beep command in Windows PowerShell.

Hey, Scripting Guy! Question How can I send a sound in Windows PowerShell to notify a user if an error occurs in the script?

Hey, Scripting Guy! Answer Windows PowerShell can send a Beep to the console:

[console]::beep(500,300)

Change the value of the first number to alter the pitch (anything lower than 190 or higher than 8500 can’t be heard), and change the value of the second number to alter the duration:

[console]::beep(2000,500)

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.