是在這裏看到Get minimum value in an array and then get indexPowershell中的含義是什麼?
$myArray = [int[]]5,66,4,33,2,9,9,12
$minvalue=[int]($myArray | measure -Minimum).Minimum
$myArray.IndexOf($minvalue)
,但無法找到它意味着在谷歌,我只能找到測量-對象。
是在這裏看到Get minimum value in an array and then get indexPowershell中的含義是什麼?
$myArray = [int[]]5,66,4,33,2,9,9,12
$minvalue=[int]($myArray | measure -Minimum).Minimum
$myArray.IndexOf($minvalue)
,但無法找到它意味着在谷歌,我只能找到測量-對象。
,找出最簡單的方法,命令做什麼(或更嚴格地說,它是),是使用Get-Command
。對於你的情況,它會告訴你Measure
是 - 就像在其他answerees已經告訴 - 別名Measure-Object
:
PS> Get-Command measure
CommandType Name Version Source
----------- ---- ------- ------
Alias measure -> Measure-Object
它真正不可以用Get-Help
發現了什麼 - 會導致 - 在你的情況在:
SYNOPSIS Calculates the numeric properties of objects, and the characters, words, and lines in string objects, such as files of text.
注:Get-Command
別名gcm
和Get-Help
至help
。請記住,雖然別名可以在交互式shell中幫助您,但它們應該在腳本中避免使用。
Measure
是Measure-Object
的標準PowerShell別名。使用Measure
或Measure-Object
做同樣的事情。
您還可以通過運行該命令使用PowerShell驗證這一點:
Get-Alias measure
在PowerShell中另一種常見的任務是測量基於一些數字屬性一組對象 的。用於此任務的cmdlet是 Measure-Object,它具有度量的別名。所有你需要做的是 指定屬性名稱和要執行的度量類型。 cmdlet具有用於添加值(-Sum),計算平均值( - 平均值)以及查找最小值( - 最小值)和最大值( - 最大值)的參數。
寫的傑弗裏·希克斯從文章:http://m.windowsitpro.com/powershell/powershell-basics-sorting-measuring-objects
快速提示:'Get-Command Measure' – Clijsters