命令get-command -type cmdlet 不显示定义。也许您想查看get-command 的定义? :)
要查看定义,您可以使用以下两种方式之一,如果命令支持,您只需在命令后添加-? 即可获得帮助。示例:
get-command -?
-? 相当于 bash 中的 --h 或 --help。某些命令不支持 taht,因为这将是命令中的参数,例如 if 命令。对于这些类型的命令,您可以使用:
get-help if
它会向您显示对if 的帮助,或者向您显示名称相似的东西,您可以获得帮助。这方面的一个例子是break 命令。 break 不支持 -? 方法,因此您必须使用 get-help break 但它也不会出现在那里。相反,您会得到以下输出:
Name Category Module Synopsis
---- -------- ------ --------
Disable-PSBreakpoint Cmdlet Microsoft.PowerShell.U... Disables the breakpoints in the current console.
Enable-PSBreakpoint Cmdlet Microsoft.PowerShell.U... Enables the breakpoints in the current console.
Get-PSBreakpoint Cmdlet Microsoft.PowerShell.U... Gets the breakpoints that are set in the curre...
Remove-PSBreakpoint Cmdlet Microsoft.PowerShell.U... Deletes breakpoints from the current console.
Set-PSBreakpoint Cmdlet Microsoft.PowerShell.U... Sets a breakpoint on a line, command, or varia...
about_Break HelpFile Describes a statement you can use to immediate...
您可以在别名about_Break 下看到break 帮助文件。因此,如果我输入get-help about_Break,它将向我显示帮助。
您还可以使用 get-help 来查找所有 cmdlets,例如 get-command 和 get-help -type cmdlet,但如果您想检查一下,我建议您查看 get-help 的帮助:)。
更多信息(字面意思):您可以使用以下四个命令之一找到有关某些 cmdlet 的更多信息:
To see the examples, type: "get-help <command name> -examples".
For more information, type: "get-help <command name> -detailed".
For technical information, type: "get-help <command name> -full".
For online help, type: "get-help <command name> -online"
例如(没有双关语),您可以使用以下方式在 get-help 上找到帮助:
get-help Get-Help -examples
get-help Get-Help -detailed
get-help Get-Help -full
get-help Get-Help -online
并且交换机将具有上述标准(示例、额外信息、技术信息和在线帮助,因为有更多关于在线事物的文档)