Question

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

enter image description here

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

enter image description here

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

Was it helpful?

Solution

PS>( Get-ItemProperty $PATH |select -ExpandProperty Options|where {$_ -match "-Dhttp.port"}).split("=")[1]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top