Professional Windows Server 1002003 Security A Technical Reference [Electronic resources]

Roberta Bragg

نسخه متنی -صفحه : 415/ 374
نمايش فراداده

set

Set local environment variables.

Location

Internal

Syntax

set Variable = String

Options

None

Displays current environment variables and their settings

Variable

The environment variable to set

String

The string to be associated with the environment variable

Examples

Create an environment variable named

APPVAR and assign it the string value C:\stuff:

set appvar=c:\stuff

Use the echo command to display the value of the variable:

echo %appvar%
c:\stuff

Use the variable just created in a dir command:

dir %appvar%
Volume in drive C has no label.
Volume Serial Number is D405-058E
Directory of c:\stuff
03/27/2003  07:28 PM    <DIR>          .
03/27/2003  07:28 PM    <DIR>          ..
03/27/2003  10:23 AM            12,307 Budget.rtf
03/27/2003  10:23 AM            20,677 Report.rtf
03/27/2003  10:23 AM            11,767 Resume.rtf
3 File(s)         44,751 bytes
2 Dir(s)   8,023,367,680 bytes free

Notes

  • The set command can be used at the Recovery Console; see Recovery Console in Chapter 4 for more info.

  • Environment variables set using set are available only for the current console session. To set persistent variables, use setx instead.

See Also

cmd, setx