Play invisible music with batch file?
audio, batch-file, hidden
Solution
@echo off
set "file=track12.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
just change `track12.mp3` with the name of your audio file
To loop the same song:
@echo off
set "file=track12.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
:loop
start "" /wait /min sound.vbs
goto:loop
Problem
I've seen a cfew threads that say how to play music with the play minimized when it starts with `start /min`, as well as one that creates a VBS script to run the audio minimized. But no matter which way I try to get audio to run minimized, it appears on screen. Also, if I try `start /min` or `start /max` I'll get the same result. Does anyone know how I can get something to start minimized?