3

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".

Sandeep
  • 199
  • 1
  • 4
  • 13
  • What have you got so far? Doesn't the Get-ItemProperty work properly? – vonPryz Jan 03 '13 at 12:49
  • 1
    It is working properly (as what the doc says), but I want only non Powershell items and also want to read a specific value of key inside that value from "Options". I was wondering if there is any easy way than writing code to avoid all PS items, then writing code to split based on space, then find out the value for "-Dhttp.port" I have updated the original post with the output I get – Sandeep Jan 03 '13 at 13:16

1 Answers1

5
PS>( Get-ItemProperty $PATH |select -ExpandProperty Options|where {$_ -match "-Dhttp.port"}).split("=")[1]
Loïc MICHEL
  • 24,935
  • 9
  • 74
  • 103