Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
SET--Notes
◄Examples► ◄Syntax►
────────────────────────────────────────────────────────────────────────────
SET──Notes
Displaying the current environment settings
When you type the SET command alone, MS-DOS displays the current environment
settings. These settings usually include the COMSPEC and PATH environment
variables that MS-DOS uses to help find programs on disk. PROMPT, DIRCMD and
COPYCMD are some other environment variables that MS-DOS uses. For more
information about DIRCMD, see the <DIR> command.
Using parameters
When you use a SET command and specify values for both variable and string,
MS-DOS adds the specified variable value to the environment and associates
the string with that variable. If the variable already exists in the
environment, the new string value replaces the old string value.
If you specify only a variable and an equal sign (without a string) for the
SET command, MS-DOS clears the string value associated with the variable (as
if the variable is not there at all).
Using SET in batch files
When creating batch files, you can use the SET command to create variables
and use them in the same way as you would the numbered variables %0 through
%9. You can also use the variables %0 through %9 as input for the SET
command.
Calling a SET variable from a batch file
When you call a variable value from a batch file, you must enclose the value
with percent signs (%). For example, if your batch program creates an
environment variable named BAUD, you can use the string associated with BAUD
as a replaceable parameter by inserting %BAUD% on the command line.
Effect of SET on environment space
After you use a SET command, MS-DOS might display the following message:
Out of environment space
This message means the available environment space is insufficient to hold
the new variable definition. For information about how to increase the
environment space, see the <COMMAND> command.
Using the COPYCMD environment variable
You can set the COPYCMD environment variable to specify whether you want the
COPY, MOVE, and XCOPY commands to prompt you for confirmation before
overwriting a file, whether issued from the command prompt or a batch file.
To force the COPY, MOVE, and XCOPY commands to prompt you before overwriting
in all cases, set the COPYCMD environment variable to /-Y. To force these
commands to overwrite in all cases without prompting you, set the COPYCMD
environment variable to /Y.
Typing any of these commands with the /Y or /-Y switch overrides all
defaults and the current setting of the COPYCMD environment variable.
♦