Batch file executing a sound silently

2019-06-05 05:22发布

Would it be possible to execute a mp3 silently from batch I have tried:

@echo off
1.mp3
pause

It works but it doest do it silently it launches WMP. does any one know how I could accomplish this. I am making a program and the track it one of the sound effects.

1条回答
2楼-- · 2019-06-05 06:00

Here is a Bat/VBS to play an audio file :

@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

Or you can use this small command i wrote in Autoit (playsound.exe)

Use : playsound.exe "youraudiofile.mp3/wav"

查看更多
登录 后发表回答