Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- PowerShell -ExecutionPolicy Bypass <script.ps1> -musicFile <file/url>
- #>
- param([string]$musicFile = "http://static.echonest.com/audio2/1353978910554/06%20What%20If%20We%20Could%20.mp3")
- Add-Type -AssemblyName presentationCore
- $mediaPlayer = New-Object system.windows.media.mediaplayer
- $mediaPlayer.open($musicFile)
- $mediaPlayer.Play()
- Start-Sleep -seconds 2 # need to wait for mediaPlayer to determine file duration
- Start-Sleep -seconds $mediaPlayer.NaturalDuration.TimeSpan.TotalSeconds
- $mediaPlayer.Stop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement