How to add comments in a batch file

The keyword REM (short for remarks) is used to add comments in batch file. Following are some examples of comments:

rem This batch file provides an example 

rem to add comments in batch file.

rem the keyword rem must be followed by a space to work correctly.

rem

rem Clear the screen in following statement.

cls

 

What does the “@” sign mean in “@echo off “?

By default, the echo feature is on in MS-DOS-based (and later, Windows) systems when executing a batch file. That means that every command issued in a batch file (and all of its output) would be echoed to the screen. By issuing, the ‘echo off’ command, this feature is turned off but as a result of issuing that command, the command itself will still show up on the screen. By including the ‘@’ symbol in ‘@echo off’, it will prevent the ‘echo off’ command from being seen on the screen.