PowerShell获取帮助无法识别参数注释
基于(除其他外),我一直在尝试让Powershell的get Help识别函数参数注释,但无法使其工作。 例如,以下函数使用.PARAMETER关键字PowerShell获取帮助无法识别参数注释,powershell,Powershell,基于(除其他外),我一直在尝试让Powershell的get Help识别函数参数注释,但无法使其工作。 例如,以下函数使用.PARAMETER关键字 function Add-Extension { param ([string]$Name,[string]$Extension = "txt") $name = $name + "." + $extension $name <# .SYNOPSIS Adds a file name extension to a supplied na
function Add-Extension
{
param ([string]$Name,[string]$Extension = "txt")
$name = $name + "." + $extension
$name
<#
.SYNOPSIS
Adds a file name extension to a supplied name.
.DESCRIPTION
Adds a file name extension to a supplied name.
Takes any strings for the file name or extension.
.PARAMETER Name
Specifies the file name.
.PARAMETER Extension
Specifies the extension. "Txt" is the default.
#>
}
没有任何参数信息的迹象。
有人能告诉我原因吗?为了获取参数详细信息,您显然需要使用
-detailed
或-full
开关,即获取帮助添加扩展名-detailed
。当我使用第一个示例中的代码执行此操作时,我得到
PS D:\Scripts> Get-Help Add-Extension -detailed
NAME
Add-Extension
SYNOPSIS
Adds a file name extension to a supplied name.
SYNTAX
Add-Extension [[-Name] <String>] [[-Extension] <String>] [<CommonParameters>]
DESCRIPTION
Adds a file name extension to a supplied name.
Takes any strings for the file name or extension.
PARAMETERS
-Name <String>
Specifies the file name.
-Extension <String>
Specifies the extension. "Txt" is the default.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
REMARKS
To see the examples, type: "get-help Add-Extension -examples".
For more information, type: "get-help Add-Extension -detailed".
For technical information, type: "get-help Add-Extension -full".
PS D:\Scripts>获取帮助添加扩展-详细信息
名称
添加扩展名
提要
向提供的名称添加文件扩展名。
语法
添加扩展名[[-Name][[-Extension]][]
描述
向提供的名称添加文件扩展名。
获取文件名或扩展名的任何字符串。
参数
-名字
指定文件名。
-延伸
指定扩展名。“Txt”是默认值。
此cmdlet支持常用参数:详细、调试、,
ErrorAction,ErrorVariable,WarningAction,WarningVariable,
exputffer、PipelineVariable和OutVariable。有关详细信息,请参阅
关于公共参数(http://go.microsoft.com/fwlink/?LinkID=113216).
评论
要查看示例,请键入:“获取帮助添加扩展-示例”。
有关详细信息,请键入:“获取帮助添加扩展-详细信息”。
有关技术信息,请键入:“获取帮助添加扩展-完整”。
Microsoft文档对此并不清楚。要获取参数详细信息,显然需要使用
-detailed
或-full
开关,即获取帮助添加扩展名-detailed
。当我使用第一个示例中的代码执行此操作时,我得到
PS D:\Scripts> Get-Help Add-Extension -detailed
NAME
Add-Extension
SYNOPSIS
Adds a file name extension to a supplied name.
SYNTAX
Add-Extension [[-Name] <String>] [[-Extension] <String>] [<CommonParameters>]
DESCRIPTION
Adds a file name extension to a supplied name.
Takes any strings for the file name or extension.
PARAMETERS
-Name <String>
Specifies the file name.
-Extension <String>
Specifies the extension. "Txt" is the default.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
REMARKS
To see the examples, type: "get-help Add-Extension -examples".
For more information, type: "get-help Add-Extension -detailed".
For technical information, type: "get-help Add-Extension -full".
PS D:\Scripts>获取帮助添加扩展-详细信息
名称
添加扩展名
提要
向提供的名称添加文件扩展名。
语法
添加扩展名[[-Name][[-Extension]][]
描述
向提供的名称添加文件扩展名。
获取文件名或扩展名的任何字符串。
参数
-名字
指定文件名。
-延伸
指定扩展名。“Txt”是默认值。
此cmdlet支持常用参数:详细、调试、,
ErrorAction,ErrorVariable,WarningAction,WarningVariable,
exputffer、PipelineVariable和OutVariable。有关详细信息,请参阅
关于公共参数(http://go.microsoft.com/fwlink/?LinkID=113216).
评论
要查看示例,请键入:“获取帮助添加扩展-示例”。
有关详细信息,请键入:“获取帮助添加扩展-详细信息”。
有关技术信息,请键入:“获取帮助添加扩展-完整”。
Microsoft文档对此不清楚。谢谢!确实如此。本文中根本没有提到详细的开关。-full开关仅与获取参数属性表有关。我留下了这样的评论,也许它甚至会得到解决。谢谢你的时间,谢谢!确实如此。本文中根本没有提到详细的开关。-full开关仅与获取参数属性表有关。我留下了这样的评论,也许它甚至会得到解决。谢谢你的时间。
PS D:\Scripts> Get-Help Add-Extension -detailed
NAME
Add-Extension
SYNOPSIS
Adds a file name extension to a supplied name.
SYNTAX
Add-Extension [[-Name] <String>] [[-Extension] <String>] [<CommonParameters>]
DESCRIPTION
Adds a file name extension to a supplied name.
Takes any strings for the file name or extension.
PARAMETERS
-Name <String>
Specifies the file name.
-Extension <String>
Specifies the extension. "Txt" is the default.
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
REMARKS
To see the examples, type: "get-help Add-Extension -examples".
For more information, type: "get-help Add-Extension -detailed".
For technical information, type: "get-help Add-Extension -full".