Home » Questions » Computers [ Ask a new question ]

How to emit sound using built-in speaker from a command line?

How to emit sound using built-in speaker from a command line?

How to emit sound using built-in speaker from a command line in Windows and Linux?

Asked by: Guest | Views: 440
Total answers/comments: 2
bert [Entry]

"You can call the Win32 MessageBeep operating system function.

On Windows XP or later, type:

rundll32 user32.dll,MessageBeep

I tried it years ago and at first I didn't believe it would work. But that's Microsoft suggested way, as according to their MSDN website:

""...MessageBeep attempts to play the
system default sound. If it cannot
play the system default sound, the
function produces a standard beep
sound through the computer speaker."""
bert [Entry]

"With bash on Unix:

echo $'\007'"