3
这工作:如何使用变量名称从对象访问属性?
$psISE.Options.DebugBackgroundColor = '#FFC86400'
这不:
$attribute = 'DebugBackgroundColor'
($psISE.Options)[$attribute] = '#FFC86400'
ERROR: Unable to index into an object of type Microsoft.PowerShell.Host.ISE.ISEOptions
我想设置选项中使用$attribute
变量foreach循环属性。
有没有办法做到这一点?
在双引号不用了。这项工作很好:'$ psISE.Options。$ attribute'。 – PetSerAl