I'm trying to make a batch file which plays music in the background like this But, I found out when I terminate the file by pressing X, the music is still playing.
This is a good sample:
@echo off
set file=http://www.soundjay.com/button/button-2.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
I have now 3 issues with this.
It creates a file in the directory of the .bat itself.
it doesn't delete it afterwards.
It keeps playing till it ends and then terminates the background program, but it doesn't terminate it when I press X on the commandprompt