Peter Ye
Peter Ye

Reputation: 487

Echo a Bell Character Cmd

At the command prompt in Windows, I can echo a bell character by typing echo and then holding down Ctrl+G to produce echo ^G, and it will make a bell noise when I run it.

When I actually type echo ^G with my keyboard, it will only print G onto the screen and not make any noise.

Can someone explain this?

Thanks

Upvotes: 13

Views: 16880

Answers (1)

sgmoore
sgmoore

Reputation: 16067

The ^G in the first case is supposed to represent one character which is the Ctrl-G character.

When you are typing ^G you are typing two characters and they are interpreted as two characters.

However the command line treats ^ as a special character to let it know that the next character is to be treated literally, so it is not actually displayed on the screen, so you just see the G.

Upvotes: 10

Related Questions