Comment In A Batch File
Windows Batch File Input Arguments
REMIn a batch fileREM at the start of a line signifies a comment or REMARK,alternatively adding:: atthe start of a line has a similar effect.For example:@ECHO OFF:::: First commentREM Second commentREMEcho Hello REM This remark is displayed by echoEcho Hello & REM This remark is ignored by echoCopy work.xls backup.xls:: We backed up the fileAlthough you can use Rem without a comment to add vertical spacing to a batchfile, you can also use completely blank lines. The blank lines are ignored when processingthe batch program.The double-colon is not documented as a comment command, itisa special case of a that acts as a comment. An important limitation of this is that as a label it can only be used at the beginning of the line.An alternative approach is to use plain text and a command to jump execution past the comments: @Echo OFFGoto:START Description can go herewhich can even include - characters:START Comments within bracketed code blocks.When labels are used as comments within a or FOR command, the command processor will expect (not unreasonably) that every label is followed by at least one command. (That way if you jump to the label it will have something to execute.) In fact the CMD shell will attempt to execute the second line:(Echo This example will fail:: some comment)(:NormalLabel & Echo this will not be executed.:SecondaryLine & Echo This will be executed.)When working within parenthesis/brackets it is safer to use REM for all comment lines.
Comment In A Dos Batch File
Where to download fate stay night visual novel. The second way of commenting out a line in a batch file is by utilizing a clever trick that in essence has you converting your comment line into a label by prefixing it with a double colon (::). The first colon tells the batch interpreter that the following text is a label, while the second colon invalidates the label status but then forces the interpreter to still treat the line as a label anyway.
Comments are closed.