Programming Field

‘@’ (Suppress command output) - DOS/Command Prompt Reference

In batch files, placing this symbol (at mark) at the head of command line suppresses command line output.

Syntax

@<command>
<command>
Specifies any command line. You can specify multiple command lines with ‘( )’ characters.

Details

Usage of ‘@’

The commands without ‘@’ character in batch files will be output before execution. This output may be noisy, so you can suppress it by adding ‘@’ to the head of command lines.

Another method to suppress outputs is to execute ‘echo off’. Many batch files first execute ‘echo off’ to suppress outputs of command lines. If you simply write ‘echo off’, the command line ‘echo off’ will be printed, so you can use ‘@’ character as ‘@echo off’ to suppress the command line.

* If you dare to output command lines, you can use ‘echo on’ and adjust output format by using Prompt command. However, even in this case command lines starting with the ‘@’ character will not be output.

Samples

Sample 1 (Batch file)

@gcc.exe -o main main.c

Executes command ‘gcc.exe -o main main.c’, but don't output this command line.

Sample 2 (Batch file)

@echo off

Suppresses outputs of following command lines and the prompt such as ‘C:\>’ by using Echo command. If you forget ‘@’ character, ‘C:\>echo off’ would be printed to the screen.