Windows 7 – How to Display the Contents of an Environment Variable from the Command Prompt in Windows 7

command lineenvironment-variableswindowswindows 7

In Windows 7, when I start the Command prompt, is there any command to display the contents of an environment variable (such as the JAVA_HOME or PATH variables)?

I have tried with echo $PATH, echo PATH and $PATH but none of these work.

Best Answer

In Windows Command-Prompt the syntax is echo %PATH%

To get a list of all environment variables enter the command set

To send those variables to a text file enter the command set > filename.txt


Related