Make Money

Meet The Command Prompt - The Echo command

This command is not very useful in the command window but is very useful when creating batch programmes. This command has two states, it is either on or off. The command is easy to use. It functions by making your prompt and commands either visible on the command window or not.

To turn on echo, you simply type echo followed by on. There should be a space between echo and on(or off for that matter).
echo off  turns off echo.

Simply typing echo will tell you the current state of the echo command. It will either tell you whether echo is on or echo is off.

One functionality of echo that comes in handy mainly in batch programmes is using echo to output messages. This command takes the form echo, followed by a SPACE, then the MESSAGE to be output.
For example

echo how are you?

will print the text "how are you" to the screen.

Note that you may not want the commands you have kept in your batch file to be displayed. In this case, you start your program by typing @echo off. This will make only messages preceded by echo appear on the screen.

For example,

@echo off
echo I will now list the commands that are available
echo Press any key to shutdown the computer
shutdown -s -t 05

When the above example is put in a batch file, the only things printed are the sentences that follow the echo command.
Without the first line (@echo off), every other thing is printed including the statements following the echo command.

with echo off

with echo on

The echo command can send its output into a specified file by appending or overwriting its content. (virtually every other command can)
You say echo hello world >> myoutputfile.txt to append the text hello world to the file myoutputfile.txt.

You can output a blank line by using the command echo. (echo followed by the dot).  

Popular posts from this blog

MMS Settings for MTN Ghana

Manual internet settings for Glo Ghana