为什么windows powershell命令称为cmdlet?

在使用Windows PowerShell时,您可能遇到了cmdlet这个术语,并发现自己有些困惑。cmdlet是否与命令完全不同,或者只是它们的PowerShell名称?今天的超级用户问答帖子回答了一位好奇的读者的问题。...

为什么windows powershell命令称为cmdlet?

在使用Windows PowerShell时,您可能遇到了cmdlet这个术语,并发现自己有些困惑。cmdlet是否与命令完全不同,或者只是它们的PowerShell名称?今天的超级用户问答帖子回答了一位好奇的读者的问题。

今天的问答环节是由SuperUser提供的,SuperUser是Stack Exchange的一个分支,是一个由社区驱动的问答网站分组。

问题

超级用户读者RBT想知道为什么Windows PowerShell命令被称为cmdlet:

I have been trying to figure out the nomenclature for why commands are called command-lets (cmdlets) in PowerShell. Why they are not simply called commands instead? What is the difference?

I could only guess based on this Wikipedia article about PowerShell that it might somehow be an abbreviation of the command line interface to interact with commands written in .Net.

为什么Windows PowerShell命令称为cmdlet?

答案

超级用户贡献者LotPings为我们提供了答案:

According to Microsoft:

A cmdlet is a lightweight command that is used in the Windows PowerShell environment. The Windows PowerShell runtime invokes these cmdlets within the context of automation scripts that are provided at the command line. The Windows PowerShell runtime also invokes them programmatically through Windows PowerShell APIs.

How Cmdlets Differ from Commands

Cmdlets differ from commands in other command-shell environments in the following ways:

  • Cmdlets are instances of .NET Framework classes; they are not stand-alone executables.
  • Cmdlets can be created from as few as a dozen lines of code.
  • Cmdlets do not generally do their own parsing, error presentation, or output formatting. Parsing, error presentation, and output formatting are handled by the Windows PowerShell runtime.
  • Cmdlets process input objects from the pipeline rather than from streams of text, and cmdlets typically deliver objects as output to the pipeline.
  • Cmdlets are record-oriented because they process a single object at a time.

Source: Cmdlet Overview [Microsoft]


有什么要补充的解释吗?在评论中发出声音。想从其他精通技术的Stack Exchange用户那里了解更多答案吗?在这里查看完整的讨论主题。

  • 发表于 2021-04-08 02:40
  • 阅读 ( 1166 )
  • 分类:互联网

你可能感兴趣的文章

可提高windows管理技能的powershell cmdlet

Powershell是一个完美的方式,一个新的编码器开始在Windows上。Powershell是命令行工具和脚本语言的等价部分。它使您能够通过您用来管理计算机的相同命令使计算机自动化。如果您有一个现代的Windows系统,那么您已经有了Powershell...

  • 发布于 2021-03-13 13:26
  • 阅读 ( 283 )

使用此powershell脚本在windows中自动执行文件加密

文件加密和解密可以是一个工作位。但是,使用PowerShell扩展,可以将进程精简为一行命令。为此,我们需要安装Gpg4win和Powershell模块。使用脚本,我们可以自动化文件加密和解密过程。 ...

  • 发布于 2021-03-13 21:58
  • 阅读 ( 343 )

使用powershell而不是批处理脚本的5个原因

... 为什么这是个好消息?因为你的PowerShell知识将不再局限于一个操作系统。批处理脚本只能在Windows上运行(或者通过Wine在Linux上运行,我们不建议这样做),因此它是有限...

  • 发布于 2021-03-15 16:49
  • 阅读 ( 277 )

如何在windows 10上复制或移动文件和文件夹

...示文件资源管理器的所有技巧,以及如何在命令提示符和PowerShell中使用它们。您甚至可以将“复制到”和“移动到”添加到文件资源管理器的上下文菜单中。 在Windows 10中复制文件或文件夹时,所选项目将被复制并保存在所选的...

  • 发布于 2021-04-02 06:41
  • 阅读 ( 273 )

Windows10中重命名文件和文件夹的6种方法

...将使用以下命令: ren "Home Movie.ogv" "First Birthday.ogv" 使用powershell重命名文件和文件夹 在命令行环境中重命名文件和文件夹时,Windows PowerShell甚至比命令提示符更强大、更灵活。虽然我们只讨论命名文件的表面,但您可以做一些...

  • 发布于 2021-04-02 09:15
  • 阅读 ( 248 )

如何在windows 10上安装powershell 7

微软于2020年3月4日宣布PowerShell 7.0。这是PowerShell、Microsoft跨平台命令行shell和脚本语言的最新主要更新。下面是什么新的,以及如何在Windows PC上安装它。 powershell 7有什么新功能? 最新版本PowerShell 7是在以前的PowerShell Core 6.1基...

  • 发布于 2021-04-02 11:09
  • 阅读 ( 280 )

如何在Windows10中自动连接到特定应用的vpn

使用Windows10的PowerShellcmdlet,您可以轻松地添加应用程序,以便在启动时自动触发VPN连接。自动化这个任务意味着当你使用某些应用程序时,你甚至不必考虑连接到VPN。 要利用PowerShell中的此功能,如果您还没有VPN服务,则必须...

  • 发布于 2021-04-02 15:58
  • 阅读 ( 518 )

如何在远程计算机上运行powershell命令

PowerShell远程处理允许您在远程Windows系统上运行PowerShell命令或访问完整的PowerShell会话。它类似于SSH,用于访问其他操作系统上的远程终端。 PowerShell在默认情况下是锁定的,因此在使用它之前必须启用PowerShell远程处理。如果您...

  • 发布于 2021-04-07 12:13
  • 阅读 ( 245 )

如何在windows powershell中使用命令历史记录

Windows PowerShell具有内置的命令历史记录功能,可提供有关已运行命令的详细信息。与命令提示符一样,PowerShell只记住当前会话的命令历史记录。 如何使用命令行缓冲区 相关:极客学校:学习如何用PowerShell自动化Windows PowerShel...

  • 发布于 2021-04-08 03:50
  • 阅读 ( 279 )

如何在windows 10上安装.appx或.appxbundle软件

...应用程序,但在开发应用程序时不一定要签名。 这就是为什么有另一种安装Appx软件的方法。这只适用于“未打包”形式的应用程序。桌面应用程序转换器还创建一个未打包的应用程序(您可以使用下面的命令安装),以及最终...

  • 发布于 2021-04-08 13:08
  • 阅读 ( 407 )
1706284
1706284

0 篇文章

相关推荐