What does :: (double colon) mean in DOS batch files?

:: is a label (inaccurately also known as comment label) can be, in practice, considered a comment just as REM is, because it is an “un-goto-able” label.

There are some differences between REM and ::, though. The main ones are:

  • With ECHO ON a REM line is shown but not a line commented with ::

  • A :: can execute a line end caret (that is, a ^ at the end of a line starting with :: makes the next line also a comment):

     :: This is a comment^
     echo but watch out because this line is a comment too
    
  • Labels and :: have a special logic and can cause problems in parentheses blocks – take care when using them inside ( ). Example:

     for %%D in (hi) do (
         echo Before...
         :: My comment
         :: Some other comment
         echo After...
     )
    

    Outputs:

     Before ...
     The system cannot find the drive specified.
     After...
    

Leave a Comment