Skip to content

Commit e73e26f

Browse files
committed
Update play-happy-birthday.ps1
1 parent 7501f71 commit e73e26f

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

scripts/play-happy-birthday.ps1

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,42 @@
44
.DESCRIPTION
55
This PowerShell script plays the famous Happy Birthday song.
66
.EXAMPLE
7-
PS> ./play-happy-birthday
7+
PS> ./play-happy-birthday.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(1059.274, 300)
15-
[System.Console]::Beep(1059.274, 200)
16-
[System.Console]::Beep(1188.995, 500)
17-
[System.Console]::Beep(1059.274, 500)
18-
[System.Console]::Beep(1413.961, 500)
19-
[System.Console]::Beep(1334.601, 950)
20-
[System.Console]::Beep(1059.274, 300)
21-
[System.Console]::Beep(1059.274, 200)
22-
[System.Console]::Beep(1188.995, 500)
23-
[System.Console]::Beep(1059.274, 500)
24-
[System.Console]::Beep(1587.117, 500)
25-
[System.Console]::Beep(1413.961, 950)
26-
[System.Console]::Beep(1059.274, 300)
27-
[System.Console]::Beep(1059.274, 200)
28-
[System.Console]::Beep(2118.547, 500)
29-
[System.Console]::Beep(1781.479, 500)
30-
[System.Console]::Beep(1413.961, 500)
31-
[System.Console]::Beep(1334.601, 500)
32-
[System.Console]::Beep(1188.995, 500)
33-
[System.Console]::Beep(1887.411, 300)
34-
[System.Console]::Beep(1887.411, 200)
35-
[System.Console]::Beep(1781.479, 500)
36-
[System.Console]::Beep(1413.961, 500)
37-
[System.Console]::Beep(1587.117, 500)
38-
[System.Console]::Beep(1413.961, 900)
39-
exit 0 # success
15+
try {
16+
[System.Console]::Beep(1059.274, 300)
17+
[System.Console]::Beep(1059.274, 200)
18+
[System.Console]::Beep(1188.995, 500)
19+
[System.Console]::Beep(1059.274, 500)
20+
[System.Console]::Beep(1413.961, 500)
21+
[System.Console]::Beep(1334.601, 950)
22+
[System.Console]::Beep(1059.274, 300)
23+
[System.Console]::Beep(1059.274, 200)
24+
[System.Console]::Beep(1188.995, 500)
25+
[System.Console]::Beep(1059.274, 500)
26+
[System.Console]::Beep(1587.117, 500)
27+
[System.Console]::Beep(1413.961, 950)
28+
[System.Console]::Beep(1059.274, 300)
29+
[System.Console]::Beep(1059.274, 200)
30+
[System.Console]::Beep(2118.547, 500)
31+
[System.Console]::Beep(1781.479, 500)
32+
[System.Console]::Beep(1413.961, 500)
33+
[System.Console]::Beep(1334.601, 500)
34+
[System.Console]::Beep(1188.995, 500)
35+
[System.Console]::Beep(1887.411, 300)
36+
[System.Console]::Beep(1887.411, 200)
37+
[System.Console]::Beep(1781.479, 500)
38+
[System.Console]::Beep(1413.961, 500)
39+
[System.Console]::Beep(1587.117, 500)
40+
[System.Console]::Beep(1413.961, 900)
41+
exit 0 # success
42+
} catch {
43+
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
44+
exit 1
45+
}

0 commit comments

Comments
 (0)