Display, assign, or remove environment variables.
string]]] set /p
promptstring] set /p
promptstring] set /a
The environment is a small portion of memory
devoted to the storage of a few values called environment variables.
set is used to manipulate environment variables
from the command line, but since the Command
Prompt’s environment is reset when its window is
closed, the usefulness of
set is fairly limited.
To affect more permanent changes to environment variables, go to
Control Panel → System → Advanced
tab → Environment variables. This window should be
fairly self-explanatory; the variables in the upper listing are for
the current user and variables in the lower listing apply to all
users. Some environment variables, such as the
Temp user variable, are assigned with respect to
other variables, like this:
%USERPROFILE% (note the percent signs
%) on either side) signifies the
USERPROFILE variable, which represents the path of
the current user’s home directory. See path, earlier in this chapter,
for another example of this usage.
In addition to providing a simple means of interapplication communication, environment variables are also useful for storing data used repeatedly in a batch file (see Section 6.5, later in this chapter).
set without options to display all of the
current environment variables. Type
set with only a variable name (no equal sign or ...