How to play audio file on windows from command line?

Kilo picture Kilo · Oct 15, 2009 · Viewed 51.1k times · Source

In Windows, is there a simple way (i.e. something you could type on a single command line) to just play a couple of .mp3 files and then exit on its own?

wmplayer, for example, does not seem to exit when finished, forcing the harried user to hunt it down and click it closed every time. (wmplayer 11 also seems to strangely repeat some files if you pass it a list.) (The older (1990's) versions of 'mplayer' used to support a '/close' command line option, but it doesn't seem to work in wmplayer 11.)

I'd prefer to use something that everyone will have on their machine (like wmplayer, quicktime...)

Answer

joshcomley picture joshcomley · Feb 4, 2013

Old question, new answer - you could use PowerShell:

powershell -c (New-Object Media.SoundPlayer 'c:\PathTo\YourSound.wav').PlaySync();