Powershell get-childitem env:path returns ellipsed one line, how to have something useful?

3

I want to know what is the content of my path variable, so I ran this command:

D:\> Get-ChildItem env:path

Name                           Value
----                           -----
Path                           %SystemRoot%\system32\WindowsPowerShell\v1.0\;D:\java\jdk\javaFX2.0\bin;C:\Program Files (x86)\PuTTY;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files (x86)\PHP\;C:\oraclexe\app\oracle\product\10.2.0\serve...

The problem is that the result is quite useless.

How can I have it plain text and without ellipsis ?

Guillaume

Posted 2012-08-14T13:16:37.873

Reputation: 628

Answers

6

Everything in powershell is an object. If you want to get the Value of the Path environment variable you have to access that:

(Get-ChildItem env:path).Value

EBGreen

Posted 2012-08-14T13:16:37.873

Reputation: 7 834

is there an alternative something like $object | get-childitem env:path | format-list ? – whytheq – 2016-02-07T22:30:23.607

I was aware of the object orientation of powershell, but I did not have a clue about the .Value to get a text representation. Thanks a lot. – Guillaume – 2012-08-14T13:24:32.963

1Normal object oriented stuff. Most every language that I am aware of uses dot notation to access the properties and methods of an object. In this case the only tricky bit is that you are accessing a property of an anonymous object rather than assigning it to a variable then accessing it like this: $foo = Get-ChildItem env:path; $foo.Value – EBGreen – 2012-08-14T13:29:23.053

1

Below command shows the full PATH info instantly.

PS D:\> $env:path

Ikhoon Chon

Posted 2012-08-14T13:16:37.873

Reputation: 11

This doesn't show the full path, either, if your path is longer than 2452 characters. PowerShell always truncates it. – Suncat2000 – 2017-06-21T13:10:24.110

1Could you explain why this is better? – Daniel Beck – 2013-04-08T20:44:49.820

This is not a better solution but showing PATH value without ellipsis. I changed my comments to avoid confusion. – Ikhoon Chon – 2013-04-09T10:31:10.117