3.25 SET

Use SET to set an environment variable to a specified value.

When you use SET in a login script, you must include quotation marks (“ ”) around values.

If a variable is set to a path that ends in a backslash and quote (\”), these two characters are interpreted as an embedded quote preceded by an escape character. To avoid this problem, use two backslashes before the ending quotes (\\”).

You do not need to include SET commands in login scripts. For example, you might decide to place some SET commands in the workstation's autoexec.bat file. Where you use SET commands depends upon your individual needs.

This command does not work in a login script if the DOS workstation's environment is too small. In this case, you should set the environment size in the CONFIG.SYS file.

After you use the SET command to set a value for an environment variable, you can use that variable in other login script commands.

To include an environment variable as an identifier variable in a command, enclose the name of the variable in angle brackets (for example, <emailuser>).

Command Format

[TEMP or DOS] SET name="value"

Replace name with an environment parameter that identifies the environment you want to change.

Replace value with identifier variable substitutions. Values must be enclosed in quotation marks.

To change the environment for the login script, but not for the workstation itself after the login script has finished executing, use the optional keyword TEMP.

NOTE:In Linux, all of the SET commands are not persistent and only apply to the specific login session they are associated with, as is standard with Linux.


You can use SET to make a prompt display the current directory path (such as F:\HOME\MARY>) rather than just the drive letter. To do this, add the following line to the login script:


“$P” lists the current directory path and “$G” displays a greater-than sign (>).

To set a path for a program called DAILY, which is in the REPORTS subdirectory under drive G:, you would add the following line:


This sets the variable PATH to g:reports\daily.

Setting the variable PATH in the login script removes any search drives previously assigned. Use SET PATH only before you map search drives. SET PATH also overwrites any paths set in the user's autoexec.bat file.

To display this path, you can include PATH as an identifier variable in a WRITE command. For example, the following line displays My path is G:\REPORTS\DAILY:

WRITE "My path is ";path

To include an environment variable in a MAP command, precede the variable with a percent sign (%). For example, you could include the following lines in a login script to set and map a drive to the variable NWS:

MAP S16:=%<NWS>