Reputation: 4862
Is there any syntax for multi-line code block comment in Windows batch script? I know REM
and ::
for line-by-line comment, but it is not efficient to comment a code block.
I'm looking for the block comment style like something below in PHP:
/*
This is multi-lines
block comment
*/
Upvotes: 1
Views: 6828
Reputation: 73
Multiline comment without those nasty goto
s, rem
s and ::
@break || (
1 line
2 line
3 line
4 line
5 line
...
)
EDIT: As the previous example is not working, you can create a macro
set "[:=goto :]%%"
set "[=rem/||(" & set "]=)"
%[:%
multiline
comment
%:]%
(Not works in the for loop)
Upvotes: 0
Reputation: 67216
You may use this trick that looks better...
@echo off
setlocal
set comment=goto endcomment
echo This line is executed
%comment%
echo These lines
echo are commented out...
:endcomment
echo The next line to execute
%comment%
You may place here
%$#"#% anything you want.... &!>|<()
:endcomment
echo End of example
Upvotes: 2
Reputation: 20980
I think, this can serve the purpose
goto:skip1
echo This line should not get executed
format c: & echo nor this line
:skip1
Upvotes: 3