We can get the complete list of environment variables using Get-Childitem cmdlet. The following command list all the local environment variables.
Get-ChildItem Env:
Instead of listing all the environment variables, you can also get the value of specific environment variable by passing the specified variable name.
The below command gets the current computer name.
Get-Childitem Env:computername
Advertisement