How do I get help messages to appear for my Powershell script parameters?

后端 未结 3 638
庸人自扰
庸人自扰 2020-12-07 11:24

I have a powershell script (setup.ps1), that we use as the entry point for our development environment setup scripts. It takes a parameter:

par         


        
3条回答
  •  暖寄归人
    2020-12-07 11:48

    one just needs the <# .SYNOPSIS #> part on top of the file to make it work and you can comment your params nicely inline:

    <# .SYNOPSIS #>
    param(
       [String]$foo   ## my 1st cool param
      ,[Switch]$bar  ## my 2nd crazy switch
    )
    ...
    

    (checked with PS 5.1.14409.1018)

提交回复
热议问题