Skip to content

Instantly share code, notes, and snippets.

@crmckenzie
Created August 19, 2014 21:06
Show Gist options
  • Save crmckenzie/f9eb2e7a59f3318e5bb7 to your computer and use it in GitHub Desktop.
Save crmckenzie/f9eb2e7a59f3318e5bb7 to your computer and use it in GitHub Desktop.
Analyze your PATH variable
$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