最佳答案
在 PowerShell 中,如何通过指定对象的名称(字符串)来获取对象的属性值?我想要这样的东西:
$obj = get-something
# View the object's members:
$obj | gm
# I could retrieve a property by doing so:
write-host $obj.SomeProp
# But for many purposes, I would really want to:
write-host $obj | Get-PropertyByName "SomeProp"
PowerShell 中有类似于“ Get-PropertyByName”的内容吗?