Created
August 19, 2014 21:06
-
-
Save crmckenzie/f9eb2e7a59f3318e5bb7 to your computer and use it in GitHub Desktop.
Analyze your PATH variable
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$path = $env:Path.Split(';') | Where-Object {[string]::IsNullOrWhiteSpace($_) -eq $false } | Sort-Object { $_ } | |
"Paths that do not exist" | |
$pathsThatDoNotExist = $path | Where-Object {[System.IO.Directory]::Exists($_) -eq $false} | |
$pathsThatDoNotExist | |
"" | |
"" | |
"" | |
"Scrubbed path variable" | |
$pathsThatExist = $path | Where-Object {[System.IO.Directory]::Exists($_) -eq $true} | |
$scrubbedPathVariable = [string]::join(';', $pathsThatExist) | |
$scrubbedPathVariable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment