Is it possible to list all environment variables from a Windows' command prompt?
Something equivalent to PowerShell's gci env:
(or ls env:
or dir env:
).
Select Start > All Programs > Accessories > Command Prompt. In the command window that opens, enter set. A list of all the environment variables that are set is displayed in the command window.
The most used command to displays the environment variables is printenv . If the name of the variable is passed as an argument to the command, only the value of that variable is displayed.
Environment variables in PowerShell are stored as PS drive (Env: ). To retrieve all the environment variables stored in the OS you can use the below command. You can also use dir env: command to retrieve all environment variables and values.
Just do:
SET
You can also do SET prefix
to see all variables with names starting with prefix
.
For example, if you want to read only derbydb from the environment variables, do the following:
set derby
...and you will get the following:
DERBY_HOME=c:\Users\amro-a\Desktop\db-derby-10.10.1.1-bin\db-derby-10.10.1.1-bin
Jon has the right answer, but to elaborate a little more with some syntactic sugar..
SET | more
enables you to see the variables one page at a time, rather than the whole lot, or
SET > output.txt
sends the output to a file output.txt which you can open in Notepad or whatever...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With