Structure of a batch file Syntax: echo off cmd

Diese Seite gibt es auch in Deutsch

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 hallo

Output:

hallo

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 hallo

Output:

hallo

📢 A new post will be linked here shortly: Practical examples with batch allow push notifications?

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 ich bin ein Kommentar

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 hallo
pause

Output:

hallo
Drücken Sie eine beliebige Taste . . .
positive Bewertung({{pro_count}})
Rate Post:
{{percentage}} % positive
negative Bewertung({{con_count}})

THANK YOU for your review!



Questions / Comments