3

The set command will list some variables, but but not all.

echo %CD% will list the current directory variable but it's not included in the set listing.

Is there a command that will list all variable names and values?

1
  • Please take the tour. Commented Sep 9, 2021 at 15:20

1 Answer 1

3

As set /? documents (emphasis mine):

If Command Extensions are enabled, then there are several dynamic environment variables that can be expanded but which don't show up in the list of variables displayed by SET. These variable values are computed dynamically each time the value of the variable is expanded. If the user explicitly defines a variable with one of these names, then that definition will override the dynamic one described below:

%CD% - expands to the current directory string.

%DATE% - expands to current date using same format as DATE command.

%TIME% - expands to current time using same format as TIME command.

%RANDOM% - expands to a random decimal number between 0 and 32767.

%ERRORLEVEL% - expands to the current ERRORLEVEL value

%CMDEXTVERSION% - expands to the current Command Processor Extensions version number.

%CMDCMDLINE% - expands to the original command line that invoked the Command Processor.

%HIGHESTNUMANODENUMBER% - expands to the highest NUMA node number on this machine.

So if you want to see the value of the dynamic environment variables, you have to explicitly access them.

Sign up to request clarification or add additional context in comments.

1 Comment

ah ! i didnt think of trying the built in help oops thanks :D

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.