Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Generate Random Beeps with PowerShell

$
0
0

Summary: Use Windows PowerShell to generate random beeps.

Hey, Scripting Guy! Question How can I generate random beeps by using Windows PowerShell?

Hey, Scripting Guy! Answer Create a range of numbers between 190 and 8500 that will determine the tone.
          Use the Get-Random cmdlet to choose a random number of tones. Pipe the results to the 
          ForEach-Object cmdlet, and call the Beep static method from the system.console class.
          The first number determines the tone, and the second number determines the length of the tone.
          Here is an example of this technique:

190..8500 | Get-Random -Count 35 | ForEach {[console]::Beep($_, 150)}


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>