為什麼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
  • 閱讀 ( 111 )
  • 分類:網際網路

你可能感興趣的文章

使用此powershell指令碼在windows中自動執行檔案加密

檔案加密和解密可以是一個工作位。但是,使用PowerShell擴充套件,可以將程序精簡為一行命令。為此,我們需要安裝Gpg4win和Powershell模組。使用指令碼,我們可以自動化檔案加密和解密過程。 ...

  • 發佈於 2021-03-13 21:58
  • 閲讀 ( 105 )

使用powershell而不是批處理指令碼的5個原因

大多數使用者從未聽說過PowerShell,更不用說觸控它並試用了。這可能是因為這個名字,聽起來像是隻有鐵桿IT極客才會使用的東西。或者是因為PowerShell的好處還不清楚。可能是因為最初的學習曲線。 ...

  • 發佈於 2021-03-15 16:49
  • 閲讀 ( 91 )

如何在windows 10上覆制或移動檔案和資料夾

...示檔案資源管理器的所有技巧,以及如何在命令提示符和PowerShell中使用它們。您甚至可以將“複製到”和“移動到”新增到檔案資源管理器的上下文選單中。 在Windows 10中複製檔案或資料夾時,所選專案將被複制並儲存在所選的...

  • 發佈於 2021-04-02 06:41
  • 閲讀 ( 91 )

Windows10中重新命名檔案和資料夾的6種方法

...將使用以下命令: ren "Home Movie.ogv" "First Birthday.ogv" 使用powershell重新命名檔案和資料夾 在命令列環境中重新命名檔案和資料夾時,Windows PowerShell甚至比命令提示符更強大、更靈活。雖然我們只討論命名檔案的表面,但您可以做...

  • 發佈於 2021-04-02 09:15
  • 閲讀 ( 77 )

Windows10中開啟powershell的9種方法

PowerShell是一種比命令提示符更強大的命令列shell和指令碼語言。自從Windows10釋出以來,它就成了預設的選擇,而且有很多方法可以開啟它。 PowerShell的使用更為複雜,但它比命令提示符更加健壯和強大。這就是為什麼它成為高階...

  • 發佈於 2021-04-02 10:35
  • 閲讀 ( 78 )

如何在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
  • 閲讀 ( 79 )

如何在Windows10中自動連線到特定應用的vpn

使用Windows10的PowerShellcmdlet,您可以輕鬆地新增應用程式,以便在啟動時自動觸發VPN連線。自動化這個任務意味著當你使用某些應用程式時,你甚至不必考慮連線到VPN。 要利用PowerShell中的此功能,如果您還沒有VPN服務,則必須...

  • 發佈於 2021-04-02 15:58
  • 閲讀 ( 81 )

如何用巧克力糖將linux風格的apt-get安裝帶到windows上

...多時間。 您可以在兩個地方使用chocolate:命令提示符和PowerShell。下面介紹如何在兩種環境中安裝此軟體包管理器,但實際上您只需要其中一種。隨便挑你喜歡的。 從命令提示符安裝並使用chocolate Chocolatey只有在以管理員身份...

  • 發佈於 2021-04-07 10:34
  • 閲讀 ( 80 )

如何在遠端計算機上執行powershell命令

PowerShell遠端處理允許您在遠端Windows系統上執行PowerShell命令或訪問完整的PowerShell會話。它類似於SSH,用於訪問其他作業系統上的遠端終端。 PowerShell在預設情況下是鎖定的,因此在使用它之前必須啟用PowerShell遠端處理。如果您...

  • 發佈於 2021-04-07 12:13
  • 閲讀 ( 75 )
1706284
1706284

0 篇文章

作家榜

  1. admin 0 文章
  2. 孫小欽 0 文章
  3. JVhby0 0 文章
  4. fvpvzrr 0 文章
  5. 0sus8kksc 0 文章
  6. zsfn1903 0 文章
  7. w91395898 0 文章
  8. SuperQueen123 0 文章

相關推薦