什么是 PowerShell cmdlet? [英] What is a PowerShell cmdlet?

查看:64
本文介绍了什么是 PowerShell cmdlet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从概念上介绍 cmdlet,

Approaching cmdlets in a conceptual way,

  1. 它们是如何制作的?他们编译了吗?

  1. How are they made? Are they compiled?

它是否相当于 PowerShell 的批处理文件?是脚本还是二进制文件?

Is it the equivalent of a batch file for PowerShell? Is it a script or a binary?

用于存储这些 cmdlet 的结构是什么?

What is the structure used for storing these cmdlets?

推荐答案

PowerShell cmdlet 是编译后的 .NET 代码片段,如果我没记错的话,更准确地说是单个类.Cmdlet 是 PowerShell 领域中的一种本机"命令,能够处理对象输入和输出,并且通常与(基于对象的)管道配合得很好.

A PowerShell cmdlet is a compiled piece of .NET code, more precisely a single class if I am not mistaken. Cmdlets are kind of the "native" commands in PowerShell land, being able to handle object input and output as well as usually playing nice and well with the (object-based) pipeline.

Cmdlet 在文件系统中没有直接表示,因为它们不是程序或类似的东西.它们仅存在于 PowerShell 中.您可以使用 Get-Command cmdlet 来查询所有可用的 cmdlet、函数等.

Cmdlets have no direct representation in the file system, as they are not programs or similar. They exist solely within PowerShell. You can use the Get-Command cmdlet to query all available cmdlets, functions, etc.

您可以使用 .NET 语言编写 cmdlet,例如C#.使用 PowerShell v2 还可以编写所谓的高级函数 其行为与 cmdlet 类似,具有类似的功能,但被解释为 PowerShell 代码,而不是已编译的类.这可能会导致运行时开销.

You can write cmdlets with a .NET language, such as C#. With PowerShell v2 there is also the possibility to write so-called advanced functions which behave similarly to cmdlets and have comparable capabilities but are interpreted PowerShell code, instead of compiled classes. This may incur a run-time overhead.

这篇关于什么是 PowerShell cmdlet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆