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 . . .
{{percentage}} % positive