【问题标题】:Code block comment syntax in Windows batch scriptWindows 批处理脚本中的代码块注释语法
【发布时间】:2015-02-09 15:48:32
【问题描述】:

Windows 批处理脚本中的多行代码块注释有语法吗?我知道REM:: 用于逐行注释,但注释代码块效率不高。

我正在寻找类似 PHP 中的块注释样式:

/*
This is multi-lines
block comment
*/

【问题讨论】:

标签: windows batch-file syntax comments


【解决方案1】:

我认为,这可以达到目的

goto:skip1
echo This line should not get executed
format c: & echo nor this line
:skip1

【讨论】:

    【解决方案2】:

    批处理脚本中没有这样的东西。

    (排除 goto...)

    【讨论】:

      【解决方案3】:

      你可以使用这个看起来更好的技巧......

      @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
      

      【讨论】:

        【解决方案4】:

        没有gotos、rems 和::的多行注释

        @break || (
         1 line
         2 line
         3 line
         4 line
         5 line
         ...
        )
        

        【讨论】:

          猜你喜欢
          • 2016-05-13
          • 1970-01-01
          • 1970-01-01
          • 2010-10-06
          • 2019-08-05
          • 2018-06-19
          • 2021-05-30
          • 1970-01-01
          相关资源
          最近更新 更多