因此,我编写了一些函数来简化我的常见任务,并尝试使用相对正确的Get-Help
信息对它们进行记录。但是,它不会显示。
我的$profile
中充满了乐趣,这是问题吗?
这是我的功能之一,我尝试匹配about_Comment_Based_Help:
Function Service-Restarter ($service, $vm){
<#
.SYNOPSIS
Restart [redacted] services running on client/server.
.DESCRIPTION
Using the windows "Services" tool to connect to other clients/servers is very slow.
This function quickly restarts the [redacted] services running on a client/server.
.EXAMPLE
Service-Restarter service* Computer-Name-Here
.ALIAS
srestart
#>
Restart-Service -InputObject $(Get-Service -ComputerName $vm -Name $service)
}
Set-Alias srestart Service-Restarter
这是Get-Help
返回的结果:
[41]PS:>help srestart -full
NAME
Service-Restarter
SYNTAX
Service-Restarter [[-service] <Object>] [[-vm] <Object>]
PARAMETERS
-service <Object>
Required? false
Position? 0
Accept pipeline input? false
Parameter set name (All)
Aliases None
Dynamic? false
-vm <Object>
Required? false
Position? 1
Accept pipeline input? false
Parameter set name (All)
Aliases None
Dynamic? false
INPUTS
None
OUTPUTS
System.Object
ALIASES
srestart
REMARKS
None
这是常规搜索显示的内容:
[45]PS:>help restart Name Category Module Synopsis ---- -------- ------ -------- Service-Restarter Function ... Restart-Computer Cmdlet Microsoft.PowerShell.M... Restarts ("reboots") the operating system on local and remote computers. Restart-Service Cmdlet Microsoft.PowerShell.M... Stops and then starts one or more services.
答案 0 :(得分:0)
基于注释的帮助需要在结尾#>
后有2个空行答案 1 :(得分:0)
.ALIAS不是有效的基于注释的帮助关键字。 Powershell将显示该条目,但将省略名称,语法,别名和备注以外的所有内容。