Skip to content

Instantly share code, notes, and snippets.

@nyabla
Created March 19, 2016 16:33
Show Gist options
  • Save nyabla/2e4bd2a6b39e8a420e2d to your computer and use it in GitHub Desktop.
Save nyabla/2e4bd2a6b39e8a420e2d to your computer and use it in GitHub Desktop.
Play a music file without a window popping up.
set "example.mp3"
( echo Set Sound = CreateObject("WMPlayer.OCX.7"^)
echo Sound.URL = "%file%"
echo Sound.Controls.play
echo do while Sound.currentmedia.duration = 0
echo wscript.sleep 100
echo loop
echo wscript.sleep (int(Sound.currentmedia.duration^)+1^)*1000) >sound.vbs
start /min sound.vbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment