在Windows批处理脚本中有没有多行代码块注解的语法?我知道REM和::是逐行注解,但是注解一个代码块效率不高。我正在寻找像下面的PHP块注解样式:
REM
::
/*This is multi-linesblock comment*/
/*
This is multi-lines
block comment
*/
字符串
lc8prwob1#
我认为,这可以达到目的,
goto:skip1echo This line should not get executedformat c: & echo nor this line:skip1
goto:skip1
echo This line should not get executed
format c: & echo nor this line
:skip1
trnvg8h32#
你可以用这个看起来更好的技巧...
@echo offsetlocalset comment=goto endcommentecho This line is executed%comment%echo These linesecho are commented out...:endcommentecho The next line to execute%comment%You may place here %$#"#% anything you want.... &!>|<():endcommentecho End of example
@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
You may place here
%$#"#% anything you want.... &!>|<()
echo End of example
pzfprimi3#
在批处理脚本中没有这样的东西。(gotos excluded.)
shyt4zoc4#
没有那些讨厌的goto s、rem s和::的多行注解
goto
rem
@break || ( 1 line 2 line 3 line 4 line 5 line ...)
@break || (
1 line
2 line
3 line
4 line
5 line
...
)
EDIT:由于前面的示例不起作用,您可以创建一个宏
set "[:=goto :]%%"set "[=rem/||(" & set "]=)"
set "[:=goto :]%%"
set "[=rem/||(" & set "]=)"
%[:% multiline comment%:]%
%[:%
multiline
comment
%:]%
的数据(Not在for循环中工作)
4条答案
按热度按时间lc8prwob1#
我认为,这可以达到目的,
字符串
trnvg8h32#
你可以用这个看起来更好的技巧...
字符串
pzfprimi3#
在批处理脚本中没有这样的东西。
(gotos excluded.)
shyt4zoc4#
没有那些讨厌的
goto
s、rem
s和::
的多行注解字符串
EDIT:由于前面的示例不起作用,您可以创建一个宏
的数据
(Not在for循环中工作)