2

I was trying to figure out the nomenclature of calling commands in powershell as command-let (cmdlet). Why they are simply not called commands, instead (what is the difference?). I could only guess from this wikipedia page that this might be somehow an abbreviation of command line interface to interact with commands written in Microsoft .NET.

EDIT: I found an interesting related thread - Powershell cmdlet vs .NET Class

12
  • A cmdlet is a lightweight command
    – LotPings
    Apr 1, 2017 at 6:55
  • Etymology question? That's off-topic in this site.
    – user477799
    Apr 2, 2017 at 15:39
  • 1
    @LotPings Please convert your comment into an answer.
    – DavidPostill
    Apr 2, 2017 at 15:42
  • 2
    @FleetCommand I'd argue that it's not off topic as there is an explicit answer in the MS docs.
    – DavidPostill
    Apr 2, 2017 at 15:44
  • 1
    @FleetCommand, you have a point that etymology is getting away from site scope, and such questions are often closed. In this case, the question combined that with something on-topic (at least in my own view), the difference between a command and a commandlet. I removed the etymology portion to make the question more clearly on-topic, and because it isn't critical to the basic question.
    – fixer1234
    Apr 2, 2017 at 16:33

1 Answer 1

8

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .