How to read multi line multi string registry entri

2019-07-09 03:21发布

问题:

I am trying to read the "-Dhttp.port" value with no luck.

AS you can see in the attached image, "Options" is a sub-key and I am able to read "Options" using the following snippet (this shows unnecessary PowerShell items too though)

Get-ItemProperty $PATH -Name "Options"    

Now from the multi-line "Options" I want to read the value of specific sub-key "-Dhttp.port" which is 80 here

Output for Get-ItemProperty $PATH -Name "Options" is

I want to read only "Options", and from Options key I want to read value of "-Dhttp.port".

回答1:

PS>( Get-ItemProperty $PATH |select -ExpandProperty Options|where {$_ -match "-Dhttp.port"}).split("=")[1]