如何在 PowerShell 中獲得 cmdlet 支援的引數?
要了解哪些引數受 cmdlet 支援,Get-Command 會檢索命令的屬性。例如,我們需要找到 Get-Process 引數,Get-Command 會檢索該命令資訊,完整列表會給你提供該屬性。
Get-Command Get-Process | fl
一旦執行命令,就會顯示 ParameterSets 屬性,這些屬性是 cmdlet 支援的引數。
PS C:\> (Get-Command Get-Process).ParameterSets |ft -AutoSize
Name IsDefault Parameters
---- --------- ----------
Name True {Name, ComputerName, Module, FileVersionInfo..}
NameWithUserName False {Name, IncludeUserName, Verbose, Debug...}
IdWithUserName False {Id, IncludeUserName, Verbose, Debug...}
Id False {Id, ComputerName, Module, FileVersionInfo...}
InputObjectWithUserName False {InputObject, IncludeUserName, Verbose, Debug…}
InputObject False {InputObject, ComputerName, Module, FileVersionInfo...}
上述 Name 屬性是受支援的引數。
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP