Search notes:

PowerShell - the env: drive

env: is a drive that makes the names and values of environment variables accessible.

Accessing the value of a given environment variable

The values of specific environment varaiables is returned by prepending the name of the variable with $env::
write-output ""
write-output "userprofile = $env:userprofile"
write-output "home        = $env:home"
write-output ""
Github repository about-powershell, path: /language/provider/env/expand.ps1

Showing all environment variables

The get-childItem cmdlet with -path env: lists all environment variables with their values:
write-output ""
write-output "userprofile = $env:userprofile"
write-output "home        = $env:home"
write-output ""
Github repository about-powershell, path: /language/provider/env/expand.ps1

Misc

Apparently, the env: drive stores its values in System.Collections.DictionaryEntry .NET classes:
cd env:
(get-childItem OS).GetType().FullName

See also

PowerShell providers

Index