1

独自のヘルプベースのPowerShellの作成をテストするための小さなスクリプトを作成しましたが、エラーが発生しました。

Get-Help:トピック「。\testHelp.ps1」のヘルプが見つかりません。行:49文字:15 + Get-Help <<<< @PSBoundParameters | more + CategoryInfo:ResourceUnavailable:(:) [Get-Help]、HelpNotFoundException + FullyQualifiedErrorId:HelpNotFound、Microsoft.PowerShell.Commands.GetHelpCommand

テストスクリプトは次のとおりです。

<#
SYNOPSIS
retrieive a list of services from local and remote machines 
.DESCRIPTION
Retrieive services from local and remote machines and reports the following fields
.PARAMETER  Servers 
The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer.
.EXAMPLE
PS C:\> Get-Something 'One value' 32
#>
param($computername="localhost")
Get-WmiObject -Class Win32_BIOS -ComputerName $computername
4

2 に答える 2

4

.の前が欠けているようです.SYNOPSIS。また、あなたの助けはパラメータが呼び出されたと言っていますServersが、paramブロックはと言ってい$computernameます。PowerShellは、パラメーター名を検証するとは思いませんが、ヘルプの書式設定が適切であることにかなり気を配っています。:-)

結果は次のとおりです。

PS> Get-Content .\FuncHelp.ps1
<#
.SYNOPSIS
retrieive a list of services from local and remote machines 
.DESCRIPTION
Retrieive services from local and remote machines and reports the following fields
.PARAMETER  Servers 
The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer.
.EXAMPLE
PS C:\> Get-Something 'One value' 32
#>
param($computername="localhost")
Get-WmiObject -Class Win32_BIOS -ComputerName $computername


PS> .\FuncHelp.ps1 -?

NAME
    C:\Users\hillr\FuncHelp.ps1

SYNOPSIS
    retrieive a list of services from local and remote machines


SYNTAX
    C:\Users\hillr\FuncHelp.ps1 [[-computername] <Object>] [<CommonParameters>]


DESCRIPTION
    Retrieive services from local and remote machines and reports the following fields


RELATED LINKS

REMARKS
    To see the examples, type: "get-help C:\Users\hillr\FuncHelp.ps1 -examples".
    For more information, type: "get-help C:\Users\hillr\FuncHelp.ps1 -detailed".
    For technical information, type: "get-help C:\Users\hillr\FuncHelp.ps1 -full".
于 2012-04-06T15:16:25.567 に答える
0

PowerGuiと呼ばれる無料のクエストエディタを使用できます。高度なヘルプを備えた関数のスニペット(CTRL + I)があります。about_Comment_Based_Helpにあるように、すべての高度なヘルプキーワードが表示されます

関数の前または内部に配置でき<# #>ますが、ヘルプ内の特殊文字に注意してください。ネットまたはPDFドキュメントからいくつかの例をコピーして貼り付けるときにエラーが発生します。

于 2012-04-07T07:08:58.773 に答える