How can i play a sound (CPU Beep or wav, don't matter what) using the Windows cmd?
|
feedback
|
migrated from stackoverflow.com Jan 29 '10 at 2:01
This question came from our site for professional and enthusiast programmers.
|
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 | |||||
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. | |||
|
feedback
|
|
You could write a simple console application that took the sound file (or sound id) as an argument and called PlaySound | |||
|
feedback
|
|
Download this , save it somewhere. In a cmd window run:
The file holds just a single character - the BEL character . Ascii value 7. | |||
|
feedback
|
|
On XP I do this
It's not ideal but it's really easy and it works. | |||
|
feedback
|
start file.wavis 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 writebeep ^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