以下代码是 PowerShell 中内置 help 函数开头的摘录,该函数一次显示一个帮助文本屏幕。 由于 Get-Help cmdlet 的帮助主题描述了帮助函数,因此帮助函数使用 .FORWARDHELPTARGETNAME 和.FORWARDHELPCATEGORY 关键字将用户重定向到 Get-Help cmdlet 帮助主题。
Get-Helpcmdlet 显示基于注释的帮助的格式与显示从 XML 文件生成的 cmdlet 帮助内容的格式相同。 用户可以使用Get-Help的所有参数,如Detailed、Full、Examples、Online等来显示基于注释的帮助内容。 还可以为函数和脚本编写基于 XML 的帮助文件。 若要使Get-Helpcmdlet 能够查找函数或脚本的基于 XML 的帮...
All of the lines in a help topic must be contiguous. If a help topic follows a comment that is not part of that topic, there must be at least one blank line between the two. The directives can appear in any order, and some of the directives may appear multiple times. ...
Comments-based help for scripts can either appear at the beginning of the script or the end. Here are some examples: <#.<help keyword><content>#>functionGet-Function{ } or functionGet-Function{ }<#.<help keyword><content>#> Comment-Based Keywords in PowerShell ...
Get-Help 使用显示在 cmdlet、函数或脚本帮助主题的“相关链接”部分的第一个项中的 Internet 地址(统一资源标识符 [URI])。 仅当帮助主题包含以“Http”或“Https”开头的 URI 并且系统上已安装 Internet 浏览器时,此参数才适用。 有关在您编写的帮助主题中支持该功能的信息,请参阅 about_Comment_Based_Help,...
Fill in the comment-based help. Provide a description of each parameter, a description of the overall function, and examples of how it’s used. Run help about_comment_based_help for more information on writing help in this fashion.
Get-Help Stop-Process 1. 获取相关用法例子-example Get-Help Stop-Process -Examples 1. ❯ Get-Help Stop-Process -Examples NAME Stop-Process SYNOPSIS Stops one or more running processes. --- Example 1: Stop all instances of a process --- PS C:\> Stop-Process...
The examples you use in your comment-based Help should be examples that actually work in a wide variety of environments. You should implement structured error handling in advanced functions by usingTry/CatchandFinally. In yourFinallyblock, you should set your environment back to its base configurat...
只显示名称、摘要和示例。要只显示示例,请键入“(get-help <cmdlet-name>).examples”。 此参数不影响概念性(“About_”)帮助的显示。 是否为必需? false 位置? named 默认值 是否接受管道输入? false 是否接受通配符? false -Full 显示一个 cmdlet 的完整帮助文件,其中包括参数说明和属性、示例、输入和输出对象...
A header comment describing the file. A comment-based help block. The Param block defining command-line switches. Global variables. Helper routines: Now and Log. A C# source block of the PSService.exe stub. The main routine, processing every command-line switch....