The description below is from the book DOS the
Easy Way by Everett Murdock Ph.D.
CLICK HERE
for information about downloading the book.
Type: External (3.3 and later)
Syntax:
SET
SET string1=string2
Purpose: Inserts strings into the command environment. The set
values can be used later by programs.
Discussion
The SET command is used to set values that will be used by programs. DOS
holds the set strings in the area of memory reserved for the environment
(if the string already exists in the environment, it is replaced). After
a string has been set in the environment, an application program can later
access and use these strings. To use the second part of a set string
(string2) the program will specify the first part of the set string
(string1).
You can use spaces as part of set strings; therefore, do not enter a space
before or after the equal sign (unless you intend to place a space in the
string).
When the strings are placed in the environment, string1 is converted to
uppercase. However, when referring to a set string you can use either
uppercase or lowercase.
For more information about the SET command, see Chapter 6, Tips for Advanced Users, in the downloadable book DOS the Easy Way.
DOS also uses the environment internally to store data related to some
previously used commands; for example, the path designation from a
previously used PATH command is stored in the environment.
If you enter SET with no options, the current environment contents are
displayed. If you use the PROMPT or PATH commands, the parameters you set
using these commands are also added to the environment (they too will be
displayed when you enter SET with no options). Also, when DOS is started,
it always stores in the environment a ³COMSPEC² parameter. This describes
the parameter DOS uses to reload the command processor (if necessary).
If you use terminate-and-stay resident (TSR) programs that ³wait² in
memory, a copy of the current environment is placed in memory.
If you enter the SET command with an existing string1 and an equal sign,
the string is removed from the environment.
Example
You can use the SET command in batch files to define replaceable
parameters by name instead of by the number of a passed parameter. You
can, for example, place a variable name such as %file1% in your batch file
(note the percent signs before and after). Then, if you enter the
line
set file1=newfile.doc
the filename NEWFILE.DOC will be used as the %FILE1% variable when you
run your batch file. You can easily change the %FILE1% variable in the
batch file as often as needed by using the SET command.
You can also use write executable programs that look to the environment
for variables. For example, a variable used by a printer control program
to set the printing width (page size) might be set in the environment
as