Windows批处理脚本中有多行代码块注释的语法吗?我知道
REM
和 ::
用于逐行注释,但是注释代码块效率不高。
我正在寻找类似 PHP 中的块注释样式:
/*
This is multi-lines
block comment
*/
我想,这样就可以达到目的了
goto:skip1
echo This line should not get executed
format c: & echo nor this line
:skip1
你可以使用这个看起来更好的技巧...
@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
批处理脚本中没有这样的东西。
(排除……)
多行注释,没有那些讨厌的
goto
、rem
和::
@break || (
1 line
2 line
3 line
4 line
5 line
...
)
编辑:由于前面的示例不起作用,您可以创建一个宏
set "[:=goto :]%%"
set "[=rem/||(" & set "]=)"
%[:%
multiline
comment
%:]%
(在 for 循环中不起作用)