Skip to content

Commit 7501f71

Browse files
committed
Updated play-beep-sound.ps1
1 parent 3b8b88c commit 7501f71

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

scripts/play-beep-sound.ps1

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22
.SYNOPSIS
33
Plays a short beep sound
44
.DESCRIPTION
5-
This PowerShell script plays a short beep sound.
5+
This PowerShell script plays a short beep sound at 500Hz for 300ms.
66
.EXAMPLE
7-
PS> ./play-beep-sound
7+
PS> ./play-beep-sound.ps1
8+
(listen and enjoy)
89
.LINK
910
https://github.com/fleschutz/PowerShell
1011
.NOTES
1112
Author: Markus Fleschutz | License: CC0
1213
#>
1314

14-
[System.Console]::Beep(500,300)
15-
Start-Sleep -milliseconds 300
16-
exit 0 # success
15+
try {
16+
[System.Console]::Beep(500,300)
17+
Start-Sleep -milliseconds 300
18+
exit 0 # success
19+
} catch {
20+
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
21+
exit 1
22+
}

0 commit comments

Comments
 (0)