SET--Examples
To set an environment variable named INCLUDE so that the string C:\INC (the
INC directory on drive C) is associated with it, type the following
command:
set include=c:\inc
You can then use the string C:\INC in batch files by enclosing the name
INCLUDE with percent signs (%). For example, you might include the following
command in a batch file in order to display the contents of the directory
associated with the INCLUDE environment variable:
dir %include%
When MS-DOS processes this command, the string C:\INC replaces %INCLUDE%.
Another possible use for the SET command is in a batch program that adds a
new directory to the PATH environment variable, as the following example
shows:
@echo off
rem ADDPATH.BAT adds a new directory
rem to the PATH environment variable.
set path=%1;%path%
set
|