|
Re: Set-Variable In,
PS> get-variable xy | format-list -property description
get-variable xy will return an object of type PSVariable (representing the
variable itself). Description is a property of this object as you set. That
is why you can get the description property.
But in,
PS> $xy.Description
$xy actually will return the value of variable $xy, which is string
"orange". It doesn't have a description property. That is why you got
nothing back.
You should be getting the same thing with following command,
PS> $xy | format-list -property description
--
George Xie [MSFT]
Microsoft Command Shell Development
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.
"Fred J." <swim.instructor@gmail.com> wrote in message
news:1161749627.048671.242200@m7g2000cwm.googlegroups.com...
> PS> Set-Variable -name xy -value "orange"
> PS> Set-Variable -name xy -description "this variable contains a color"
> PS> Get-Variable -name xy
> Name Value
> ---- -----
> xy orange
>
> PS> Get-Variable -name xy |format-list -property *
> Name : xy
> Description : this variable contains a color
> Value : orange
> Options : None
> Attributes : {}
>
> PS> get-variable xy | format-list -property description
> Description : this variable contains a color
>
> Why isn't a value returned when I do this? All I get is a prompt.
> PS > $xy.description
> PS >
> Fred Jacobowitz
> |