Stupid PowerShell Trick #1:

Ever wanted a nice list of the directories in you PATH statement?  In PowerShell, it’s incredibly easy to get a list like that.  Here’s the command…

PS C:> $env:Path.Split(";")

That’s it!

 

As an aside, $env has several other useful references.  Check these commands out:

  • $env:windir – the base Windows install directory (usually C:Windows)
  • $env:path – the PATH environment variable
  • $env:username – the name of the current user
  • $env:homedrive – the name of the drive that the user’s homepath is located
  • $env:homepath – the name of the user’s root directory (ie, the directory above ‘My Documents’)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s