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

Roberta Bragg

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

setxnew in WS2003

Sets local or system environment variables.

Syntax

setx [/s Computer [/u [Domain\]User [/p [Password]]]] Variable Value [/m]
setx [/s Computer [/u [Domain \] User [/p [Password]]]] [Variable] 
/k Path [/m]

Options

/s Computer /u [Domain\]User /p [Password]

Name or IP address of a remote computer (if omitted, defaults to local computer) and credentials for running the script (if omitted, defaults to SYSTEM built-in identity)

Variable

Name of environment variable to set

Value

Value to assign the variable

/k Path

Registry value to assign the variable (use \HIVE\KEY\...\Value format)

/m

The environment variable is a system variable (if omitted, it is a local variable)

Examples

Set the system environment variable MYOS to the value WS2003:

setx MyOS "WS2003" /m

Set the local environment variable BootDevice to the registry value SystemBootDevice in HKLM\System\CurrentControlSet\Control:

setx BootDevice /k HKLM\System\CurrentControlSet\Control\SystemBootDevice

See Also

cmd, set