Multiline comment in PowerShell

一个人想着一个人 提交于 2020-11-26 04:54:28

问题


Can we comment multiple lines together in PowerShell?

I tried looking, but I didn't find any answer. It's quite irritating to comment each line manually if the script is too long.


回答1:


In PowerShell v2 and newer, use the following syntax for the multiline comments:

<# a
   b
   c #>



回答2:


The multiline comment in PowerShell should work.

If not, try this...

# This is
# a
# multiline comment.

or

<#
This does works for me.
#>

If it doesn't work, try to check if you have the correct version of PowerShell.



来源:https://stackoverflow.com/questions/21129746/multiline-comment-in-powershell

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!