Created
October 28, 2020 10:16
-
-
Save coderofsalvation/02029fd90b106835fd6981b854cca62e to your computer and use it in GitHub Desktop.
hasslefree playing mp3 wav audio in Windows 10 WSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -noexit | |
# Play a single file | |
# Usage: | |
# LINUX: timeout 5 ./playaudio.ps1 "c:\Users\Leon\Downloads\bensound-allthat.mp3" &>/dev/null & | |
# CMD.EXE: powershell.exe -noexit ./playaudio.ps1 "c:\Users\Leon\Downloads\bensound-allthat.mp3" | |
Add-Type -AssemblyName presentationCore | |
$mediaPlayer = New-Object system.windows.media.mediaplayer | |
$mediaPlayer.open( $args[0] ) | |
$mediaPlayer.Play() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment