Tech Tips / Windows NT / Tools and Tasks
Variables are indexes for memory counters that hold a specific value. NT command shell variables can contain either alphabetic or numeric values. To display the Windows NT command shell's preset environment variables, type the command SET. To declare a new variable and set its value, type:
SET variable=value
Variable is the variable's name and value is the variable's value. The NT command shell treats all variables you set with the SET command as text unless you use SET with the /a parameter to type the variable as numeric. Once you've set the variable, you can substitute its value in a command by enclosing the variable's name in percent signs. For example, if you execute these three command statements:
SET /a count=1 SET /a count=%count% + 1 Echo %count%
The last ECHO command statement will output the number 2 on the screen. The most important thing to remember about variable substitution is that the Windows NT command shell substitutes variables before it interprets any part of the command. Therefore, you can use variables to construct any part of a command statement, including a command itself.
Pass your MCSE certification exams with EasyCert - the most realistic exam simulations available today! Click the links bellow for free MCSE demos.
If you're an experienced IT professional and would like to share your expertise with other Setup32.com readers, why not submit a new tip to our Tech Tips area?
Sponsored Links