gpt4 book ai didi

powershell - Powershell 中未显示基于注释的帮助

转载 作者:行者123 更新时间:2023-12-02 23:22:21 27 4
gpt4 key购买 nike

我正在尝试按照 here 的描述实现基于评论的帮助。在 Windows Server 2016 上使用 Powershell 5.1。

我使用的脚本叫做 blah.ps1:

<#
.DESCRIPTION
blah blah
#>
function Blahblah
{
}

在 Powershell 中,我可以加载脚本:
.\blah.ps1

但是,当我使用以下方法寻求有关此功能的帮助时:
Get-Help Blahblah

Powershell 只报错:
Get-Help : Get-Help could not find Blahblah in a help file in this session. To download updated help topics type: "Update-Help". To get help online, search for the help topic in the TechNet library at http://go.microsoft.com/fwlink/?LinkID=107116.
At line:1 char:1
+ Get-Help Blahblah
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Get-Help], HelpNotFoundException
+ FullyQualifiedErrorId : HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand

我假设 Get-Help 可以与自定义帮助注释一起使用。我错过了什么?

最佳答案

将脚本作为模块导入,而不是运行它。

Import-Module .\blah.ps1

关于powershell - Powershell 中未显示基于注释的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47055414/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com