1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| $inventory = @{ '笔记本' = @{ Price=5999; Stock=15 } '手机' = @{ Price=3999; Stock=30 } '耳机' = @{ Price=299; Stock=100 } }
$inventory.Keys | Where-Object { $inventory[$_].Price -lt 5000 -and $inventory[$_].Stock -gt 20 } | ForEach-Object { [PSCustomObject]@{ 商品 = $_ 价格 = $inventory[$_].Price 库存 = $inventory[$_].Stock } }
|