set MS-DOS Command

(Set Environment)

Type: External (3.3 and later)



SET string1=string2

Purpose: Inserts strings into the command environment. The set values can be used later by programs.


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 on the SET command, refer to Chapter 6, Tips for Advanced Users. 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.


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

set width=wide

About Dewwa Socc

Sahifa Theme License is not validated, Go to the theme options page to validate the license, You need a single license for each domain name.