How to list or display all environment variables using powershell?


Hello, I am to powershell and not sure how what command to use to list or display all environment variables using powershell? Thanks.


Asked by:- jon
0
: 778 At:- 12/23/2022 9:17:52 AM
Powershell environment-variables







1 Answers
profileImage Answered by:- vikas_jk

You can simply use below powershell command to list environment variables, with name/value

gci env:* | sort-object name

Output of the above powershell command will be as below

list-all-environment-variables-powershell

OR

You can simply use below command

Get-ChildItem Env:

OR

If you need filtered output, you can use below command

gci env: | where name -like 'Java*'

Thanks.

1
At:- 12/23/2022 9:23:29 AM
Thanks, it worked as needed. 0
By : jon - at :- 12/23/2022 9:25:40 AM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use

Subscribe Now

Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly