SET+Setting Operating Parameters

Inserts specified names (strings) into the command

processor's environment.

VERSION

PC-DOS 2.0+

MS-DOS equivalent: SET (2.0+)

TYPE

Internal

SYNTAX

SET [name = [parameter]]

OPTIONS

name Specifies a variable.

[parameter] Specifies a new value for the environment.

SET is used to pass arguments to application programs or to

batch files that look into the DOS environment for operating

parameters.

EXAMPLES

SET FIL = \PROGFIL

instructs DOS to look in the \PROGFIL directory when an

application program interrogates the environment for FIL.

SET

displays the names that have been set in the environment, such as

the path and the prompt.

SET NAME = HAROLD

allows you to call the value assigned to NAME from a batch file.

In the batch file, you must enclose the variable NAME in percent

signs, which indicate to DOS that a variable is being used rather

than a command-line argument (see Appendix A for more information

about batch files and using variables in them). To call the value

assigned to NAME- -for example, to change to Harold's directory-

-you would enter the line in the batch file as

CD \%NAME%

If ECHO were on, you would see

CD \HAROLD

when this line was executed.

UNDO

To remove a string from the environment, you merely repeat

the SET command using the name parameter without specifying any

other parameter. For example, to remove NAME = HAROLD from the

environment, simply enter

SET Name =

NOTE

All names are converted to uppercase in the environment, but

parameters will remain uppercase and lowercase as you enter them.

The SET command is useful for allowing application programs or

batch files to be written generically while you assign values

dynamically in the course of a program or batch file.

One of the strings placed in the environment automatically

is the COMSPEC= parameter, which describes the path that DOS uses

to reload the command processor when required. To use a command

processor other than COMMAND.COM, you need to use the COMSPEC=

parameter in the SET command. Always use the drive letter in the

path used to describe the location of COMMAND.COM or your own

command processor.

------------------------------------------------------------------

[For related topics, press R]

SEE ALSO

APPEND Command

AUTOEXEC.BAT File

Batch Files

BREAK Command

COMMAND Command

CTTY Command

EXE2BIN Command

KEYB Command

KEYBxx Command

PROMPT Command