Showing posts with label batch echo. Show all posts
Showing posts with label batch echo. Show all posts

Sunday, 23 June 2019

Batch: echo ON (or) OFF


‘echo’ command display messages, or turns command-echoing on or off.

Syntax
ECHO [ON | OFF]
ECHO [message]

By default, echo is on. You can test this by executing echo command in command prompt.

C:\>echo
ECHO is on.

Why do we require ‘echo off’?
Hello.bat
ver
vol
cd

When you ran Hello.bat file, it prints the commands names also in the output.



You can display the output without command names using echo off command.

Hello.bat

@echo off
ver
vol
cd


Previous                                                 Next                                                 Home

Batch: echo command: print information


‘echo’ command is used to print the value of variable, print text.

Syntax
echo %VARIABLE_NAME%

C:\>set firstName="Krishna"

C:\>set age=29

C:\>echo %firstName%
"Krishna"

C:\>echo %age%
29



Previous                                                 Next                                                 Home