SET - Create or modify environment variables
Purpose: Display, create, modify, or delete environment variables.
Format: SET [/P /R file ...] [name [=][value ]]
file : One or more files containing variable definitions.
name : The name of the environment variable to define or
modify.
value : The new value for the variable.
/P(ause) /R(ead from file)
See also: ESET and UNSET.
Usage
Every program and command inherits an environment, which is a list of
variable names, each of which is followed by an equal sign and some text.
Many programs use entries in the environment to modify their own
actions.
If you simply type the SET command with no options or arguments, it will
display all the names and values currently stored in the environment.
Typically, you will see an entry called COMSPEC, an entry called PATH,
an entry called CMDLINE, and whatever other environment variables you and
your programs have established:
[c:\] set
COMSPEC=C:\CMD.EXE\$OS2.EXE
PATH=C:\;C:\OS2;C:\OS2\SYSTEM;C:\UTIL
CMDLINE=C:\CMD.EXE\4START.CMD
To add a variable to the environment, type SET, a space, the variable
name, an equal sign, and the text:
[c:\] set mine=c:\finance\myfiles
The variable name is converted to upper case by CMD.EXE. The text after
the equal sign will be left just as you entered it. If the variable
already exists, its value will be replaced with the new text that you
entered.
Normally you should not put a space on either side of the equal sign. A
space before the equal sign will become part of the name ; a space after
the equal sign will become part of the value.
If you use SET to create a variable with the same name as one of the
CMD.EXE internal variables, you will disable the internal variable. If
you later execute a batch file or alias that depends on that internal
variable, it may not operate correctly.
To display the contents of a single variable, type SET plus the variable
name:
[c:\] set mine
You can edit environment variables with the ESET command. To remove
variables from the environment, use UNSET, or type SET plus a variable
name and an equal sign:
[c:\] set mine=
The variable name is limited to a maximum of 80 characters. The name and
value together cannot be longer than 1,023 characters.
In CMD.EXE the size of the environment is set automatically, and
increased as necessary as you add variables.
CMD.EXE supports the "pseudo-variables" BeginLIBPath and EndLIBPath
introduced in OS/2 Warp. If you use either of these as a variable name,
CMD.EXE will pass the library path information from the SET command to
the operating system, but the variables will not appear in the
environment. See your OS/2 documentation for more information about
these "variables".
Options
/P: (Pause) Wait for a key to be pressed after each screen page
before continuing the display. Your options at the prompt are
explained in detail under Page and File Prompts.
/R: (Read) Read environment variables from a file. This is much
faster than loading variables from a batch file with multiple
SET commands. Each entry in the file must fit within the
1,023-byte command-line length limit for CMD.EXE. The file is
in the same format as the SET display (i.e., name =value ), so
SET /R can accept as input a file generated by redirecting SET
output. For example, the following commands will save the
environment variables to a file, and then reload them from
that file:
set > varlist
set /r varlist
You can load variables from multiple files by listing the
filenames individually after the /R. You can add comments to
a variable file by starting the comment line with a colon [:].
If you are creating a SET /R file by hand, and need to create
an entry that spans multiple lines in the file, you can do so
by terminating each line, except the last, with an escape
character. However, you cannot use this method to exceed the
command-line length limit.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs