如果您只是需要蜂鸣,那么 PowerShell 可以很轻松地帮助您:
1 2 3
| $frequency = 800 $durationMS = 2000 [console]::Beep($frequency, $durationMS)
|
如果您需要做一些更复杂的事,那么您可以让 PowerShell 播放一段系统声音:
1
| [System.Media.SystemSounds]::Asterisk.Play()
|
以下是支持的系统声音列表:
1 2 3 4 5 6 7 8 9 10 11 12
| PS> [System.Media.SystemSounds] | Get-Member -Static -MemberType Property
TypeName: System.Media.SystemSounds
Name MemberType Definition ---- ---------- ---------- Asterisk Property static System.Media.SystemSound Asterisk {get;} Beep Property static System.Media.SystemSound Beep {get;} Exclamation Property static System.Media.SystemSound Exclamation {get;} Hand Property static System.Media.SystemSound Hand {get;} Question Property static System.Media.SystemSound Question {get;}
|