views:

108

answers:

4

In Bash, # is used to comment the following. I was wondering in Windows command line, how to make a comment?

Thanks and regards!

+7  A: 

A comment is produced using the REM command which is short for "Remark".

REM Comment here...
Robin Day
+3  A: 

its "REM".

example:

REM this is a comment
masfenix
+2  A: 

Lines starting with "rem" (from the word remarks) are comments:

rem comment here
echo "hello"
PeterMmm
+5  A: 

You can either use REM for remark or the more shorthand version ::, which sort of looks like # if you squint :-)

I, of course, prefer the :: variant since I a bashaholic and I'm still trying to forget the painful days of BASIC.

paxdiablo
I knew of REM but was not aware of the `::` syntax. Is it not widely known?
JAB
Well, I know there's one person that knew of it. And now there's two :-) Maybe I can claim that I doubled the amount of knowledge in the world. FWIW, Rob van der Woude's site is a truly excellent one for batch file (and other) chicanery: http://www.robvanderwoude.com/batchfiles.php
paxdiablo
Note that using `::` has some nasty side-effects in older versions of Windows in conjunction with parenthesized blocks. It can sometimes throw an error about an unexpected and missing drive letter. Being a regular reader of Raymond Chen's blog I usually tend to stick to documented things :-)
Joey