Do you know how to comment a line in a batch script? Sure most of you know that it is possible with 'REM' at the start of certain line. But there are still some alternative ways. These ways are really popular among batch files creators but they can produce some unexpected errors while the execution of a batch file.
The most popular commenting style for batch scripts looks like this:
:: This is a comment
And the other one looks even simpler:
: This can also be a comment
You know that batch files syntax says that names of labels start with ":" character. So the comments above are labels for the batch files interpreter. And this is the source for some specific errors. For example, if you add such comment into blocks of code inside IF or FOR statements (between brackets), you'll see the error message. So you need to write comments before the beginning of such code block, or use traditional 'REM' instead of colons.
Thursday, December 3, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment