在为 HDInsight 编程时,我遇到了像
$storageAccountKey = Get-AzureRmStorageAccountKey
-ResourceGroupName $resourceGroupName
-Name $storageAccountName
| %{ $_.Key1 }
我明白
$_
指的是 Get-AzureRmStorageAccountKey
的结果命令。但是%{}
究竟是什么意思? ?
最佳答案
%{ $_.Key1 }
⇔ ForEach-Object { Write-Output $_.Key1 }
⇔ 对于管道中的每个对象,回显其属性的值 Key1
.%
是 alias为 ForEach-Object
. $_
是当前对象 automatic variable .
关于powershell - %{ $_.Key1 } 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35272003/