假设您正在用 C#编写一些PSCmdLet :
/// <summary>
/// Get a stack overflow exception.
/// </summary>
[Cmdlet(VerbsCommon.Join, "StackOverflow")]
[OutputType(typeof(OverflowException))]
public class JoinStackOverflow : PSCmdlet {
protected override void ProcessRecord() {
throw new OverflowException("stack");
}
}
如果将上述定义的模块加载到 PowerShell 中,该命令help Join-StackOverflow
将返回以下内容:
NAME
Join-StackOverflow
SYNTAX
Join-StackOverflow [<CommonParameters>]
ALIASES
None
REMARKS
None
如何为此 cmdlet 添加概要/摘要,例如与以下内容相同Get-Process
:
NAME
Get-Process
SYNOPSIS
Gets the processes that are running on the local computer or a remote computer.
...