Structure of a batch file Syntax: echo off cmd


If you have created a batch file, you can write a command in each line, see: how to create a batch file - basics. The commands are executed in sequence when the file is started. The behavior of the output can be adjusted as follows:

echo @ or @echo off

@ resp. @echo off control the display of the batch file
Without the @ command in front of each command, the command line and then the result is always displayed when the batch file is executed:

to illustrate a small example using the “echo” command:

The echo command prints a text in the output:

Batch file contents:

echo a Text 

Output:

echo a Text
a Text

an @ before a command suppresses the output of the command line:

Batch file contents:

@echo hello

Output:

hello

In the output the call of the command is suppressed: “echo a text”.

To not have to write an “@” in front of each command, there is the command “echo off”.
To suppress the output of the command “echo off” itself, you can then use “@echo off”.
Contents of the batch file:

@echo off
echo hello

Output:

hello

see also: Practical examples with batch

rem: Comments in the batch file

To insert comments in a batch file, the “rem” command is used.
Contents of the batch file:

rem echo this is a comment 

ignores the complete line: Nothing is output

pause

the pause command, stops the batch file and waits until any key is pressed.

@echo off
echo hello
pause

Output:

hello 
Press any key . . .
positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!

Publication: 2022-09-23 from Bernhard 🔔


Top articles in this section


sleep or wait in batch files: pause cmd
The function wait or sleep was not available in BATch files by default.Remedy is a small detour via the ping Command

Practical examples with batch
Handling variables in Windows Batch (command prompt) Read all variables Variables can be read out in the command prompt with the set command:


Questions / Comments