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 ?

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
  • 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 Aug 14 '12 at 13:24
  • 1
    Normal 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 Aug 14 '12 at 13:29
  • is there an alternative something like $object | get-childitem env:path | format-list ? – whytheq Feb 7 '16 at 22:30
1

Below command shows the full PATH info instantly.

PS D:\> $env:path
  • 1
    Could you explain why this is better? – Daniel Beck Apr 8 '13 at 20:44
  • This is not a better solution but showing PATH value without ellipsis. I changed my comments to avoid confusion. – Ikhoon Chon Apr 9 '13 at 10:31
  • This doesn't show the full path, either, if your path is longer than 2452 characters. PowerShell always truncates it. – Suncat2000 Jun 21 '17 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.