Play sounds with a batch file

2019-01-20 06:54发布

问题:

I want to play a sound or music file with Batch files, but I don't want that Windows show the window from the music player. So I want to play a sound in the background... I hope you can help me :D

回答1:

Here are few scripts.

mediarunner.bat - it uses windows media player active x objects so you cannot used if there's no installed Windows Media Player (though it usually comes packed with the Windows).Accepts only one argument - the path to the file you want to play.

spplayer.bat - uses SP Voice objects but can play only .wav files.Again it accepts as only argument the path to the file you want to play.

soundplayer.bat - uses Internet Explorer objects and specific bgsound tag that can be used only in internet explorer.Can play .mp3,wav,.. files. It can accepts two arguments. The file you want to play and the sound volume (a number between -10000 to 0) :

 call soundplayer.bat "C:\Windows\Media\Windows Navigation Start.wav" 0