Rob van der Woude's Scripting Pages

The SET command

Displays, sets, or removes environment variables.

Basic syntax

SET [variable=[string]]
variable Specifies the environment-variable name.
string Specifies a series of characters to assign to the variable.

Type SET without parameters to display the current environment variables.

Type SET variable= without a value to delete variable from the environment.

Type SET variable=value to assign value to variable. You can now use %variable% in batch files whenever you need its value.

Full syntax

MS-DOS and PC-DOS
(including Win95's MS-DOS 7)
as described above
OS/2 Warp & eCS as described above, though in CONFIG.SYS only the SET variable=value format is allowed
Windows NT 4/Windows 2000 special features: simple math with /A and /P switches, string manipulation and delayed variable expansion

page last modified: 2011-04-04; loaded in 0.0042 seconds