Wednesday, August 6, 2014

Can you use Powershell to find the environmental variable Path?

It is very easy to find path using the command line as shown:
C:\>Path

If you want to use Power Shell then you should first start PowerShell with the following command:
C:\>Powershell

If powershell is installed you should see the following change:
C:\> changes  to PS C:\>

When you are in PS C:\

type exactly as shown.
PS C:\> get-item env:
Then you should see all the environmental variables (directories) separated by a semi-colon;
A sample listing is shown here:




If you want to get a single environmental variable such as 'Path' for example
You can do this:
PS C:\> $x="Path"PS C:\> get-item env:$x
or
PS C:\> get-item env:"Path"
On this machine Windows 7 (x64) Ultimate, "Path", 'path', path all returned the 'PATH' variable.



If you want to know the version of your powershell, try this:


Have a look at this reference for PATH:
http://msdn.microsoft.com/en-us/library/aa922003.aspx
 

No comments: