PowerShell/scripts/play-beep-sound.ps1

23 lines
463 B
PowerShell
Raw Normal View History

2024-10-01 15:11:03 +02:00
<#
2021-07-13 21:10:02 +02:00
.SYNOPSIS
2021-11-08 21:27:30 +01:00
Plays a short beep sound
2021-10-04 21:29:23 +02:00
.DESCRIPTION
2024-01-25 13:50:47 +01:00
This PowerShell script plays a short beep sound at 500Hz for 300ms.
2021-07-13 21:10:02 +02:00
.EXAMPLE
2024-01-25 13:50:47 +01:00
PS> ./play-beep-sound.ps1
(listen and enjoy)
2021-07-13 21:10:02 +02:00
.LINK
https://github.com/fleschutz/PowerShell
2022-05-26 11:15:06 +02:00
.NOTES
Author: Markus Fleschutz | License: CC0
2020-12-29 15:14:21 +01:00
#>
2020-12-21 15:25:28 +01:00
2024-01-25 13:50:47 +01:00
try {
[System.Console]::Beep(500,300)
Start-Sleep -milliseconds 300
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}