Let's start working with an environment variable by using the following steps:
- To display the environment variable, type in Get-ChildItem env: or Get-Item env: and press the Enter key:
PS> Get-ChildItem env:PS> Get-Item env:
- Env: is also a PowerShell provider, and works just like a filesystem. Therefore, you could also use Set-Location at Env: and use Get-ChildItem . to list the variables that are available in your system.
- To display the value of the specified environment variable, run the following command:
PS> Get-ChildItem Env:/PATH | Select-Object value | Format-Table -Wrap
After typing Get-ChildItem Env:/, you can use tab completion to populate all environment variables.
- Use Get-Member on the PATH environment variable ...