Get-Help不会仅返回<commonparameters> </commonparameters>

时间:2014-04-09 23:26:43

标签: powershell-v3.0

(您好)

(PS V. 3)

我把头发拉到这里。我有以下代码:

<#
.SYNOPSIS
    Some Synopsis
.DESCRIPTION
    A Description
.PARAMETER MyParameter
    The script requires the MyParameter parameter to be set to Red, Green or Blue.
.EXAMPLE
    C:\PS>.\example.ps1 red
.EXAMPLE
    C:\PS>.\example.ps1 green
.EXAMPLE
    C:\PS> .\example.ps1 blue
.INPUTS
    This script take to piped input.
.OUTPUTS
    The script will return a colour to the given answer.
#>


Function Select-Colour
{
    [CmdletBinding()]
    Param (
           [Parameter(Mandatory=$True,Position=0,HelpMessage="Please enter either red, green or blue for MyParameter.")]
           [ValidateSet('Easy','Medium','Hard')]
           [System.String]
           $MyParameter
          ) 

End snip

但是,无论我在何处放置帮助标记,在函数内部,脚本的顶部或底部,它都只会列出常用参数。 #&gt;之间有两个空行。和功能选择颜色。

我能让它工作的唯一方法是将Param块放在Select-Color函数之外,但这会破坏Try / Catch块(省略)。

如何获取Get-Help。\ example.ps1 -full以显示参数MyParameter?

所有其他标签显示正常,除了示例,其中有5个空白行从某处插入。如果这是一个线索。

显然很容易!

非常感谢

W上。

0 个答案:

没有答案