|
4 | 4 | .DESCRIPTION
|
5 | 5 | This PowerShell script plays the famous Jingle Bells song.
|
6 | 6 | .EXAMPLE
|
7 |
| - PS> ./play-jingle-bells |
| 7 | + PS> ./play-jingle-bells.ps1 |
| 8 | + (listen and enjoy) |
8 | 9 | .LINK
|
9 | 10 | https://github.com/fleschutz/PowerShell
|
10 | 11 | .NOTES
|
@@ -46,115 +47,121 @@ $Duration = New-Object -TypeName psobject -Property @{
|
46 | 47 | EIGHTH = 200
|
47 | 48 | SIXTEENTH = 100
|
48 | 49 | }
|
49 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
50 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
51 |
| -[System.Console]::Beep($Notes.C, $Duration.QUARTER) |
52 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
53 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
54 |
| -[System.Console]::Beep($Notes.F, $Duration.QUARTER) |
55 |
| -[System.Console]::Beep($Notes.C, $Duration.HALF ) |
56 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
57 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
58 |
| -[System.Console]::Beep($Notes.C, $Duration.QUARTER) |
59 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
60 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
61 |
| -[System.Console]::Beep($Notes.F, $Duration.QUARTER) |
62 |
| -[System.Console]::Beep($Notes.D, $Duration.HALF ) |
63 |
| -Start-Sleep -m $Duration.EIGHTH |
64 |
| -[System.Console]::Beep($Notes.D, $Duration.EIGHTH ) |
65 |
| -[System.Console]::Beep($Notes.E, $Duration.QUARTER) |
66 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
67 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
68 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
69 |
| -[System.Console]::Beep($Notes.E, $Duration.HALF) |
70 |
| -Start-Sleep -m $Duration.EIGHTH |
71 |
| -[System.Console]::Beep($Notes.E, $Duration.EIGHTH) |
72 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
73 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
74 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
75 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
76 |
| -[System.Console]::Beep($Notes.AA, $Duration.HALF) |
77 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
78 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
79 |
| -[System.Console]::Beep($Notes.C, $Duration.QUARTER) |
80 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
81 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
82 |
| -[System.Console]::Beep($Notes.F, $Duration.QUARTER) |
83 |
| -[System.Console]::Beep($Notes.C, $Duration.HALF ) |
84 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
85 |
| -[System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
86 |
| -[System.Console]::Beep($Notes.C, $Duration.QUARTER) |
87 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
88 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
89 |
| -[System.Console]::Beep($Notes.F, $Duration.QUARTER) |
90 |
| -[System.Console]::Beep($Notes.D, $Duration.HALF ) |
91 |
| -Start-Sleep -m $Duration.QUARTER |
92 |
| -[System.Console]::Beep($Notes.D, $Duration.EIGHTH ) |
93 |
| -[System.Console]::Beep($Notes.E, $Duration.QUARTER) |
94 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
95 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
96 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
97 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
98 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
99 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
100 |
| -[System.Console]::Beep($Notes.CC, $Duration.EIGHTH) |
101 |
| -[System.Console]::Beep($Notes.DD, $Duration.QUARTER) |
102 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
103 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
104 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
105 |
| -[System.Console]::Beep($Notes.F, $Duration.HALF) |
106 |
| -[System.Console]::Beep($Notes.CC, $Duration.HALF) |
107 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
108 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
109 |
| -[System.Console]::Beep($Notes.AA, $Duration.HALF) |
110 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
111 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
112 |
| -[System.Console]::Beep($Notes.AA, $Duration.HALF) |
113 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
114 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
115 |
| -[System.Console]::Beep($Notes.F, $Duration.QUARTER) |
116 |
| -[System.Console]::Beep($Notes.G, $Duration.EIGHTH) |
117 |
| -[System.Console]::Beep($Notes.AA, $Duration.HALF) |
118 |
| -Start-Sleep -m $Duration.EIGHTH |
119 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
120 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
121 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
122 |
| -[System.Console]::Beep($Notes.BB, $Duration.EIGHTH) |
123 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
124 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
125 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
126 |
| -[System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
127 |
| -[System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
128 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
129 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
130 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
131 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
132 |
| -[System.Console]::Beep($Notes.G, $Duration.HALF) |
133 |
| -[System.Console]::Beep($Notes.CC, $Duration.HALF) |
134 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
135 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
136 |
| -[System.Console]::Beep($Notes.AA, $Duration.HALF) |
137 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
138 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
139 |
| -[System.Console]::Beep($Notes.AA, $Duration.HALF) |
140 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
141 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
142 |
| -[System.Console]::Beep($Notes.F, $Duration.QUARTER) |
143 |
| -[System.Console]::Beep($Notes.G, $Duration.EIGHTH) |
144 |
| -[System.Console]::Beep($Notes.AA, $Duration.HALF) |
145 |
| -Start-Sleep -m $Duration.EIGHTH |
146 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
147 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
148 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
149 |
| -[System.Console]::Beep($Notes.CC, $Duration.EIGHTH) |
150 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
151 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
152 |
| -[System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
153 |
| -[System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
154 |
| -[System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
155 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
156 |
| -[System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
157 |
| -[System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
158 |
| -[System.Console]::Beep($Notes.G, $Duration.QUARTER) |
159 |
| -[System.Console]::Beep($Notes.F, $Duration.HALF) |
160 |
| -exit 0 # success |
| 50 | + |
| 51 | +try { |
| 52 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 53 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 54 | + [System.Console]::Beep($Notes.C, $Duration.QUARTER) |
| 55 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 56 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 57 | + [System.Console]::Beep($Notes.F, $Duration.QUARTER) |
| 58 | + [System.Console]::Beep($Notes.C, $Duration.HALF ) |
| 59 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 60 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 61 | + [System.Console]::Beep($Notes.C, $Duration.QUARTER) |
| 62 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 63 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 64 | + [System.Console]::Beep($Notes.F, $Duration.QUARTER) |
| 65 | + [System.Console]::Beep($Notes.D, $Duration.HALF ) |
| 66 | + Start-Sleep -m $Duration.EIGHTH |
| 67 | + [System.Console]::Beep($Notes.D, $Duration.EIGHTH ) |
| 68 | + [System.Console]::Beep($Notes.E, $Duration.QUARTER) |
| 69 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 70 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 71 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 72 | + [System.Console]::Beep($Notes.E, $Duration.HALF) |
| 73 | + Start-Sleep -m $Duration.EIGHTH |
| 74 | + [System.Console]::Beep($Notes.E, $Duration.EIGHTH) |
| 75 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 76 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 77 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 78 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 79 | + [System.Console]::Beep($Notes.AA, $Duration.HALF) |
| 80 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 81 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 82 | + [System.Console]::Beep($Notes.C, $Duration.QUARTER) |
| 83 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 84 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 85 | + [System.Console]::Beep($Notes.F, $Duration.QUARTER) |
| 86 | + [System.Console]::Beep($Notes.C, $Duration.HALF ) |
| 87 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 88 | + [System.Console]::Beep($Notes.C, $Duration.EIGHTH ) |
| 89 | + [System.Console]::Beep($Notes.C, $Duration.QUARTER) |
| 90 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 91 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 92 | + [System.Console]::Beep($Notes.F, $Duration.QUARTER) |
| 93 | + [System.Console]::Beep($Notes.D, $Duration.HALF ) |
| 94 | + Start-Sleep -m $Duration.QUARTER |
| 95 | + [System.Console]::Beep($Notes.D, $Duration.EIGHTH ) |
| 96 | + [System.Console]::Beep($Notes.E, $Duration.QUARTER) |
| 97 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 98 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 99 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 100 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 101 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 102 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 103 | + [System.Console]::Beep($Notes.CC, $Duration.EIGHTH) |
| 104 | + [System.Console]::Beep($Notes.DD, $Duration.QUARTER) |
| 105 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 106 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 107 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 108 | + [System.Console]::Beep($Notes.F, $Duration.HALF) |
| 109 | + [System.Console]::Beep($Notes.CC, $Duration.HALF) |
| 110 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 111 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 112 | + [System.Console]::Beep($Notes.AA, $Duration.HALF) |
| 113 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 114 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 115 | + [System.Console]::Beep($Notes.AA, $Duration.HALF) |
| 116 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 117 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 118 | + [System.Console]::Beep($Notes.F, $Duration.QUARTER) |
| 119 | + [System.Console]::Beep($Notes.G, $Duration.EIGHTH) |
| 120 | + [System.Console]::Beep($Notes.AA, $Duration.HALF) |
| 121 | + Start-Sleep -m $Duration.EIGHTH |
| 122 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 123 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 124 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 125 | + [System.Console]::Beep($Notes.BB, $Duration.EIGHTH) |
| 126 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 127 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 128 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 129 | + [System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
| 130 | + [System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
| 131 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 132 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 133 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 134 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 135 | + [System.Console]::Beep($Notes.G, $Duration.HALF) |
| 136 | + [System.Console]::Beep($Notes.CC, $Duration.HALF) |
| 137 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 138 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 139 | + [System.Console]::Beep($Notes.AA, $Duration.HALF) |
| 140 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 141 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 142 | + [System.Console]::Beep($Notes.AA, $Duration.HALF) |
| 143 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 144 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 145 | + [System.Console]::Beep($Notes.F, $Duration.QUARTER) |
| 146 | + [System.Console]::Beep($Notes.G, $Duration.EIGHTH) |
| 147 | + [System.Console]::Beep($Notes.AA, $Duration.HALF) |
| 148 | + Start-Sleep -m $Duration.EIGHTH |
| 149 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 150 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 151 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 152 | + [System.Console]::Beep($Notes.CC, $Duration.EIGHTH) |
| 153 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 154 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 155 | + [System.Console]::Beep($Notes.AA, $Duration.QUARTER) |
| 156 | + [System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
| 157 | + [System.Console]::Beep($Notes.AA, $Duration.EIGHTH) |
| 158 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 159 | + [System.Console]::Beep($Notes.CC, $Duration.QUARTER) |
| 160 | + [System.Console]::Beep($Notes.BB, $Duration.QUARTER) |
| 161 | + [System.Console]::Beep($Notes.G, $Duration.QUARTER) |
| 162 | + [System.Console]::Beep($Notes.F, $Duration.HALF) |
| 163 | + exit 0 # success |
| 164 | +} catch { |
| 165 | + "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" |
| 166 | + exit 1 |
| 167 | +} |
0 commit comments