How to play audio file on windows from command line?
Old question, new answer - you could use PowerShell:
powershell -c (New-Object Media.SoundPlayer 'c:\PathTo\YourSound.wav').PlaySync();
Use VBScript:
Set objArgs = Wscript.Argumentsif (objArgs.Count = 0) then Wscript.echo "I need a sound file as argument!" WScript.Quit 123end ifWscript.echo "Playing: " & objArgs(0) & "..."Set objPlayer = createobject("Wmplayer.OCX.7")With objPlayer ' saves typing .settings.autoStart = True .settings.volume = 50 ' 0 - 100 .settings.balance = 0 ' -100 to 100 .settings.enableErrorDialogs = False .enableContextMenu = False .URL = objArgs(0) WScript.Sleep(10000) ' time to load and start playing '.Controls.Pause() ' stopEnd WithMsgBox "if WMP is still playing, clicking OK will end it", _ vbInformation, "WMP Demo finished"
If the VBScript process ends, the Media Player ends too, you have to wait for it (I don't need it, my sounds are only some seconds long).
I used this for my special case today:https://groups.google.com/forum/#!topic/microsoft.public.scripting.vbscript/gfOOvnN8t-U