How do I comment on the Windows command line?

In Bash, # is used to comment the following. How do I make a comment on the Windows command line?


You can either use rem for remark or the more shorthand version ::, which sort of looks like # if you squint a bit and look at it sideways :-)

I originally preferred the :: variant since I'm a bash-aholic and I'm still trying to forget the painful days of BASIC.

Unfortunately, there are situations where :: stuffs up the command line processor (such as within complex if or for statements) so I generally use rem nowadays.

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

REM Comment here...

Sometimes, it is convenient to add a comment to a command line. For that, you can use "&REM misc comment text" or, now that I know about it, "&:: misc comment text". For example:

REM SET Token="4C6F72656D20697073756D20646F6C6F" &REM This token is for localhost
SET Token="722073697420616D65742C20636F6E73" &REM This token is for production

This makes it easy to keep track of multiple sets of values when doing exploration, tests of concept, etc. This approach works because '&' introduces a new command on the same line.

It's "REM".


REM This is a comment

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

rem comment here
echo "hello"

Need Your Help

How to preview a part of a large pandas DataFrame, in iPython notebook?

python pandas dataframe ipython ipython-notebook

I am just getting started with pandas in the IPython Notebook and encountering the following problem: When a DataFrame read from a CSV file is small, the IPython Notebook displays it in a nice tabl...

Google Play Store: You need fix your high-res icon. It is not a valid image

android image icons google-play gimp

This is the error message I get when attempting to give my app an image on the play store. Here is the image.