A More Readable Path
August 20th, 2015 by Charlie Russel and tagged $Profile
The path on many modern computers gets to be so long that reading it is a nuisance. Worse, from within Windows PowerShell, there isn’t a built in equivalent to the old cmd “path” command. Yet all the information we need is there, it’s just not where we might expect it. The actual executable path for a PowerShell session is stored in $ENV:path. Here’s a quick function you put in your $profile to print out the PATH, one line for each item:
Function path { $p=$env:path $p.Split(':') }
Simple, wasn’t it? Now, when you type “path” from the Windows PowerShell prompt, you’ll see something like this:
PSH> path
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Users\charlie.russel\psbin
Posted in PowerShell | Comments Off on A More Readable Path