none
Breaking $Env:Path into an Array of Paths

    Question

  • Hello Sirs,

    Is there a way to break the $Env:Path into an Array of Paths; so that I can "divide and rule" them!

    Friday, February 22, 2013 3:50 PM

Answers

All replies

  • $env:path -split ";"
    BTW, this should be a question, not a discussion.

    Boe Prox
    Blog | PoshWSUS | PoshPAIG | PoshChat


    Friday, February 22, 2013 3:56 PM
  • Oh, thanks. I had tried it, but was certainly making some mistake. Copy/Paste is always great :-)
    Friday, February 22, 2013 4:12 PM
  • Boe's one-line solution works if there are no complexities in the PATH statement.  If there are quoted folder or semicolons in folder then a PowerShell function will do the trick.

    http://blogs.catapultsystems.com/chsimmons/archive/2018/01/30/parse-envpath-with-powershell

    Wednesday, January 31, 2018 11:39 AM