有没有一种方法可以将函数的帮助存储在变量中?

时间:2020-10-08 08:59:14

标签: powershell

PowerShell模块中有几个功能。其中一些功能共享相同的参数,因此使用Get-Help时应显示相同的帮助文本。

示例

// myModule.psm1
Function Add-Foo {
    <#
    .PARAMETER AddTen
        Adds ten to the result
    #>
}

Function Add-Bar {
    <#
    .PARAMETER AddTen
        Adds ten to the result
    #>
}

做这样的事情很棒:

// myModule.psm1
$AddTen = "Adds ten to the result"

Function Add-Foo {
    <#
    .PARAMETER AddTen
        $AddTen
    #>
}

Function Add-Bar {
    <#
    .PARAMETER AddTen
        $AddTen
    #>
}

0 个答案:

没有答案
相关问题