In Windows (e.g. version 10) you can list environment variables using the command
set
How do you list just the environment variables that are the same for all users or just the environment variables that are for the current user or session?
command lineenvironment-variables
In Windows (e.g. version 10) you can list environment variables using the command
set
How do you list just the environment variables that are the same for all users or just the environment variables that are for the current user or session?
Best Answer
Things are a little more complicated than Microsoft sometimes make it seem.
A lot of the environment variables are stored in the Registry. This means you can query them using the
reg
commandCommon to all users
Specific to current user session
Set by user
If you permanently set your own environment variable using the
setx variable value
command it is stored in the registry but not made immediately available.If you use the
set variable=value
command, the variable is available immediately but is not stored in the registry. You cannot use thereg
command to list them although they are shown byset
. These temporary environment variables do not persist after you end the command-prompt session.Dynamic Environment Variables
There are constructs that act like environment variables that are not stored in the registry in this way. For example: