Echo and Display to Screen
In all programming languages, you want to output what you type, so the user can see it on the screen. In Batch Programming, you can display what you print by typing in the echo command.
For example: echo Hello World.
Output: Hello World.
When you write a batch script, you will have to type @echo off, and this will basically hide all the background code. It will only show the code that is executed. When you write a batch script, it should be in this format:
@Echo off echo Hello World.
(C++)
int main() {
std::cout << ” hello=”” world\n
return 0
In Basic, echo is like this..
10 Print “Hello World”
In Java, you would use.
(Java)
public static void main(String args[])
{
System.out.println(“Hello, World”);
}
In Batch Programming, we just have to know it is Echo Statement, and it is as simple as that. We can print a message and display results as well.
For example:
echo What is your name?
set /p Name=
echo My name is %Name% .
set /p allows you to input characters, and %Char% outputs characters. A character is defined as letters, numbers, etc.
Output:
What is your name?
Input:
John Smith
Output:
My name is John Smith