Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 366
Peter Y. Avatar asked Mar 24 '18 16:03

Peter Y.


People also ask

How do I echo a variable in CMD?

Select Start > All Programs > Accessories > Command Prompt. In the command window that opens, enter echo %VARIABLE%. Replace VARIABLE with the name of the environment variable. For example, to check if NUKE_DISK_CACHE is set, enter echo %NUKE_DISK_CACHE%.

How do you type special characters in CMD?

In Windows, you can type any character you want by holding down the ALT key, typing a sequence of numbers, then releasing the ALT key.

What is echo command in CMD?

In computing, echo is a command that outputs the strings that are passed to it as arguments. It is a command available in various operating system shells and typically used in shell scripts and batch files to output status text to the screen or a computer file, or as a source part of a pipeline. echo.


1 Answers

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.

like image 200
sgmoore Avatar answered Sep 22 '22 02:09

sgmoore