Public/Get-EnvPath.ps1

1
2
3
4
5
6
7
8
9
function Get-EnvPath {
  [CmdletBinding()]
  param(
    [System.EnvironmentVariableTarget]$VariableTarget = [System.EnvironmentVariableTarget]::Machine
  )
  $PathSort = ([System.Environment]::GetEnvironmentVariable('PATH',$VariableTarget)).Split(';').TrimEnd('\') | Sort-Object
  Return $PathSort
}