更新时间:2022-12-31 11:08:09
使用上面的示例:
$pathCsv = ($env:TEMP + '\test.csv')
Get-Process | Export-Csv $pathCsv
#import CSV to array as hash table using the ID property as the key
$toHashTable = Import-Csv $pathCsv | Group-Object -AsHashTable -Property ID
#make changes to hashtable here
#break the hashtable into the pipeline, then grab each $_.Value property
#and break that out of the hashtable into the pipeline
$toHashTable.GetEnumerator() | ForEach{($_.Value).GetEnumerator()} | Export-Csv $pathCsv
我在这里问了这个问题,所以我可以为正在寻求解决同一问题的其他任何人回答.
I asked this question here so i could answer it for anyone else who was searching for a resolution to the same problem.