QuickTip: Have the PowerShell console beep

Using the Beep method of the System.Console namespace it is possible to have the PowerShell console produce a beeping sound. Occasionally it can be useful to have the console get your attention by producing a sound. The following line of code will produce a short ‘beep’:

[System.Console]::Beep()

It is also possible to specify two parameters for this method, the first parameter is the tone measured in hertz and the second is the duration in milliseconds. Here is an example of a beep at 6000hz for half a second:

[System.Console]::Beep(6000,500)

for more information about this class, please refer to the MSDN entry of this method, which is available here:
Console.Beep method

Share

Leave a Reply

Your email address will not be published.