setx | new in WS2003 |
Sets local or system environment variables.
setx [/s Computer [/u [Domain\]User [/p [Password]]]] Variable Value [/m] setx [/s Computer [/u [Domain \] User [/p [Password]]]] [Variable] /k Path [/m]
/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)
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
cmd, set