up vote 2 down vote favorite
share [g+] share [fb]

How can i play a sound (CPU Beep or wav, don't matter what) using the Windows cmd?

link|improve this question

1  
Using start file.wav is a bad idea. It might take a second to start a bloated media player, just for a single beep. In addition, file associations might be wrong, the media player might not play the file, or it might play it over and over again, etc. The way of creating a simple "beep" is to write beep ^G. "^G" is not the circumflex accent followed by a capital letter G, but rather a special character that you insert by pressing Ctrl+G. It is actually the BEL character with ASCII value 0x07. – Andreas Rejbrand Aug 25 '10 at 20:30
feedback

migrated from stackoverflow.com Jan 29 '10 at 2:01

This question came from our site for professional and enthusiast programmers.

6 Answers

up vote 2 down vote accepted

Not in windows now, in order to test this possible solution, but try to: "start "

I think it will open the wav file with the associated program that your windows has for ".wav" files.

And note, this is a wild-guess - someone with windows may give you a better solution if this doesn't do the job

link|improve this answer
Well, it'll certainly open the file in whatever application is associated with the type, but that's it. It's up to that application to decide what it does with it - it might play it, it might add it to a queue, or something else. Even if it does play the file, it's entirely likely that it won't terminate after playing, meaning this is probably a bad idea. – Michael Madsen Jan 29 '10 at 0:31
That's all what I needed for now.. Thanks :) – TiuTalk Jan 29 '10 at 0:53
feedback
echo ^G

Where ^G is CTRL + G or Alt + 7 on the keypad.

link|improve this answer
feedback

If a plain beep is alright, echo the character with the value 7, the so-called bell character. Note, however, that beeps can be turned off.

If you want something else, you'll have to launch an application that does the trick.

link|improve this answer
feedback

You could write a simple console application that took the sound file (or sound id) as an argument and called PlaySound

link|improve this answer
feedback

Download this , save it somewhere. In a cmd window run:

type beep

The file holds just a single character - the BEL character . Ascii value 7.

link|improve this answer
feedback

On XP I do this

start /min mplay32 /play /close %WINDIR%\media\tada.wav

It's not ideal but it's really easy and it works.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.