且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将PSCmdlet编程方式添加到PowerShell管道?

更新时间:2023-11-24 22:06:22

您cmdlet的应该有一个明确定义的语法,根据你放什么在cmdlet属性。

Your cmdlet should have a well-defined syntax, based on what you put in the Cmdlet attribute.

举例来说,这里是哪里创建我自己的明确的主机小命令启动更换内置明确的主机功能:

For instance, here's the start of where I create my own clear-host cmdlet to replace the built-in clear-host function:

<Cmdlet("clear", "host")> _
 Public Class Clearhost
     Inherits Cmdlet

从该cmdlet属性,语法我的cmdlet的是明确的主持人。你应该能够使用(因为它是一个字符串),并把它添加到管道

From the Cmdlet attribute, the syntax for my cmdlet is "clear-host". You should be able to use that (since it's a string) and add it to the pipeline.