Microsoft DOS SCANDISK Draft for Information Only
ContentMS DOS Command: SET
MS DOS Command: SETReference from Microsoft MS-DOS cmd help DescriptionDisplays, sets, or removes MS-DOS environment variables. You use environment variables to control the behavior of some batch files and programs and to control the way MS-DOS appears and works. The SET command is often used in the AUTOEXEC.BAT or CONFIG.SYS files to set environment variables each time you start MS-DOS. SyntaxSET variable=[string]
To display the current environment settings, use the following syntax: SET
Parameters
Related CommandsFor information about setting environment variables that MS-DOS uses to control its own operations, see the PATH, PROMPT, SHELL, and DIR commands. RemarksDisplaying the current environment settingsWhen 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 parametersWhen 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 filesWhen 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 fileWhen 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 spaceAfter 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 variableYou 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. ExamplesTo 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:
©sideway ID: 110700253 Last Updated: 7/30/2011 Revision: 0 Latest Updated Links
![]() ![]() ![]() ![]() ![]() |
![]() Home 5 Business Management HBR 3 Information Recreation Hobbies 8 Culture Chinese 1097 English 339 Travel 18 Reference 79 Computer Hardware 254 Software Application 213 Digitization 37 Latex 52 Manim 205 KB 1 Numeric 19 Programming Web 289 Unicode 504 HTML 66 CSS 65 SVG 46 ASP.NET 270 OS 431 DeskTop 7 Python 72 Knowledge Mathematics Formulas 8 Set 1 Logic 1 Algebra 84 Number Theory 206 Trigonometry 31 Geometry 34 Calculus 67 Engineering Tables 8 Mechanical Rigid Bodies Statics 92 Dynamics 37 Fluid 5 Control Acoustics 19 Natural Sciences Matter 1 Electric 27 Biology 1 |
Copyright © 2000-2025 Sideway . All rights reserved Disclaimers last modified on 06 September 2019