Crazy Prompt Function

by Nov 2, 2015

The built-in "prompt" function is invoked whenever PowerShell completed interactive input, and you can use it to change the way your prompt looks like.

You can also abuse it. If you smuggle this version of a prompt function into your colleagues profile script, whenever PowerShell is done executing a command, you will hear five random beeps:

function prompt 
{
  1..5 | ForEach-Object -Process {
    $frequency = Get-Random -Minimum 500 -Maximum 6000 
    $duration = Get-Random -Minimum 200 -Maximum 300 
    [Console]::Beep($frequency, $duration) 
  } 
}

Twitter This Tip! ReTweet this Tip!