Bat file comment syntax




















I borrowed this technique from "Outsider", one of the alt. Rexx, for example, will treat the whole text marked red as comment:. Leo Gutierrez Ramirez came up with an even shorter way to accomplish a comment block at the end of a batch file:. Recently, Vasco Rato showed me the solution to the mysteriously disappearing code. If you read Leo Gutierrez Ramirez ' trick of the missing closing parenthesis, you'll see that that is exactly what happens.

The following line of code:. Since there were no other parentheses in the "mystery code block" after this comment, everything from the opening parenthesis before the REM statement up to the end of the code is then a "Leo Gutierrez Ramirez style" comment block. Well, in Windows 7 they don't! So, can you explain this behaviour? The answer can be found at the end of this page. Mystery Solved Recently, Vasco Rato showed me the solution to the mysteriously disappearing code.

As Vasco states: everything behaves as one would expect it to. Thanks Vasco and Leo. I would like to mention one situation where I always prefer REM over double colons: batch files for silent installations.

Greate post. Keep posting such kind of info on your page. Im really impressed by your blog. I am sure they will be benefited from this web site.

Extremely effective and excellent, and providing such information, all can provide a passionate and worthwhile world, and has special knowledge about the subject matter. To me, the title is misleading.

If it was your intention to get more clicks by adding a title to have people come look who already knew how to do a line comment, then you succeeded. Hello There. Following is the general syntax of this statement. The above command produces the following output. You will notice that the line with the Rem statement will not be executed. The other way to create comments in Batch Script is via the :: command.

Any text which follows the :: statement will be treated as comments and will not be executed.



0コメント

  • 1000 / 1000