How do you comment out code in PowerShell?

前端 未结 10 1593
傲寒
傲寒 2020-12-12 08:59

How do you comment out code in PowerShell (1.0 or 2.0)?

10条回答
  •  鱼传尺愫
    2020-12-12 09:46

    Use a hashtag followed by a white-space(!) for this:

     # comment here
    

    Do not forget the whitespace here! Otherwise it can interfere with internal commands.

    E.g. this is NOT a comment:

    #requires -runasadmin
    

提交回复
热议问题