Warm tip: This article is reproduced from serverfault.com, please click

Play invisible music with batch file?

发布于 2014-04-26 16:34:10

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?

Questioner
Pretzel
Viewed
0
SachaDee 2020-03-24 06:47:54
@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