O'Reilly logo

Windows XP in a Nutshell, Second Edition by Troy Mott, Tim O'Reilly, David A. Karp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

set

Synopsis

Display, assign, or remove environment variables.

Syntax

set [variable[=[string]]]

set /p variable=[promptstring]

set /a expression

Description

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%\Local Settings\Temp

where %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).

Type set without options to display all of the current environment variables. Type set with only a variable name (no equal sign or value) to display a list of all ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required