mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-30 03:43:50 +01:00
83 lines
2.1 KiB
Markdown
83 lines
2.1 KiB
Markdown
Script: *play-happy-birthday.ps1*
|
|
========================
|
|
|
|
This PowerShell script plays the famous Happy Birthday song.
|
|
|
|
Parameters
|
|
----------
|
|
```powershell
|
|
PS> ./play-happy-birthday.ps1 [<CommonParameters>]
|
|
|
|
[<CommonParameters>]
|
|
This script supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction,
|
|
WarningVariable, OutBuffer, PipelineVariable, and OutVariable.
|
|
```
|
|
|
|
Example
|
|
-------
|
|
```powershell
|
|
PS> ./play-happy-birthday.ps1
|
|
(listen and enjoy)
|
|
|
|
```
|
|
|
|
Notes
|
|
-----
|
|
Author: Markus Fleschutz | License: CC0
|
|
|
|
Related Links
|
|
-------------
|
|
https://github.com/fleschutz/PowerShell
|
|
|
|
Script Content
|
|
--------------
|
|
```powershell
|
|
<#
|
|
.SYNOPSIS
|
|
Plays the Happy Birthday song
|
|
.DESCRIPTION
|
|
This PowerShell script plays the famous Happy Birthday song.
|
|
.EXAMPLE
|
|
PS> ./play-happy-birthday.ps1
|
|
(listen and enjoy)
|
|
.LINK
|
|
https://github.com/fleschutz/PowerShell
|
|
.NOTES
|
|
Author: Markus Fleschutz | License: CC0
|
|
#>
|
|
|
|
try {
|
|
[System.Console]::Beep(1059.274, 300)
|
|
[System.Console]::Beep(1059.274, 200)
|
|
[System.Console]::Beep(1188.995, 500)
|
|
[System.Console]::Beep(1059.274, 500)
|
|
[System.Console]::Beep(1413.961, 500)
|
|
[System.Console]::Beep(1334.601, 950)
|
|
[System.Console]::Beep(1059.274, 300)
|
|
[System.Console]::Beep(1059.274, 200)
|
|
[System.Console]::Beep(1188.995, 500)
|
|
[System.Console]::Beep(1059.274, 500)
|
|
[System.Console]::Beep(1587.117, 500)
|
|
[System.Console]::Beep(1413.961, 950)
|
|
[System.Console]::Beep(1059.274, 300)
|
|
[System.Console]::Beep(1059.274, 200)
|
|
[System.Console]::Beep(2118.547, 500)
|
|
[System.Console]::Beep(1781.479, 500)
|
|
[System.Console]::Beep(1413.961, 500)
|
|
[System.Console]::Beep(1334.601, 500)
|
|
[System.Console]::Beep(1188.995, 500)
|
|
[System.Console]::Beep(1887.411, 300)
|
|
[System.Console]::Beep(1887.411, 200)
|
|
[System.Console]::Beep(1781.479, 500)
|
|
[System.Console]::Beep(1413.961, 500)
|
|
[System.Console]::Beep(1587.117, 500)
|
|
[System.Console]::Beep(1413.961, 900)
|
|
exit 0 # success
|
|
} catch {
|
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
|
exit 1
|
|
}
|
|
```
|
|
|
|
*(generated by convert-ps2md.ps1 using the comment-based help of play-happy-birthday.ps1 as of 01/25/2024 13:58:41)*
|