考虑以下Powershell命令:
Get-Help Get-Help -examples
当我执行它时,示例看起来像这样:
----- Example 1: Display basic information about a command -----
Get-Help Format-Table
Get-Help -Name Format-Table
Format-Table -?
These commands display basic information about the `Format-Table` cmdlet.
`Get-Help <name>` is the simplest and default syntax of `Get-Help` cmdlet. You can omit the parameter name ( Name ).
`<command-name> -?` works only for commands.
当我用.EXAMPLE标记Powershell方法时,就像这样:
<#
.SYNOPSIS
Does stuff
.DESCRIPTION
Details about doing stuff
.PARAMETER Foo
Foos things
.EXAMPLE
Invoke-FooBar -Foo bar, baz
Foos the bar and baz
#>
它给了我这样的例子:
-------------------------- EXAMPLE 1 --------------------------
PS C:\>Invoke-FooBar -Foo bar, baz
Foos the bar and baz
我的问题是,如何更改标题以描述我要演示的内容?
答案 0 :(得分:1)
您不能-从内部注释HelpCommentsParser
将从基于注释的帮助中提取的示例转换为XML,该内部语句使用以下语句构造每个示例的标题字符串:
<div class="side-nav pull-right">
<div class="dropdown">
<button type="button" class="profile dropdown-toggle" data-toggle="dropdown" id = "dropdownMenuButton" aria-haspopup="true" aria-expanded="false">Bonjour Arthur K. <img src = "images/triangle.png" alt =""/> </button>
<div class="dropdown-menu" role="menu" aria-labelledby="dropdownMenuButton">
<a href="#" title="Utilisateurs">Utilisateurs</a>
<a href="#" title="Snippets">Snippets</a>
<a href="#" title="Traductions">Traductions</a>
</div>
</div>
<a href="#" class="profile">Mon compete</a>
</div>
relevant resource file包含string titleStr = string.Format(CultureInfo.InvariantCulture,
"\t\t\t\t-------------------------- {0} {1} --------------------------",
HelpDisplayStrings.ExampleUpperCase, count++);
值的单词EXAMPLE
,这就是为什么它总是显示为HelpDisplayStrings.ExampleUpper
,EXAMPLE 1
等的原因。
代码来自PowerShell Core 6,但是基于注释的帮助工具自3.0版以来未发生任何重大变化