xtd 0.2.0
Loading...
Searching...
No Matches

◆ set_environment_variable() [2/2]

static void xtd::environment::set_environment_variable ( const xtd::ustring variable,
const xtd::ustring value,
environment_variable_target  target 
)
static

Creates, modifies, or deletes an environment variable stored in the current process or in the Windows operating system registry key reserved for the current user or local machine.

Parameters
variableThe name of an environment variable.
valueA value to assign to variable.
Remarks
The xtd::environment::set_environment_variable(xtd::ustring, xtd::ustring, environment_variable_target) method lets you define an environment variable that is available to the current process (the xtd::environment_variable_target::process value). Environment variables that are unique to the current process environment block persist only until the process ends.
In addition, on Windows systems only, the xtd::environment::set_environment_variable(xtd::ustring, xtd::ustring, environment_variable_target) method lets you define an environment variable that is available to all processes that run on a machine (the xtd::environment_variable_target::machine value) and to all processes run by a user (the xtd::environment_variable_target::user value). Per-machine and per-user environment variables are copied into the environment block of the current process.
If the value argument is not empty and the environment variable named by the variable argument does not exist, the environment variable is created and assigned the contents of value. If it does exist, its value is modified.
If value is empty and the environment variable named by variable exists, the environment variable is deleted. If variable does not exist, no error occurs even though the operation cannot be performed.
Todo:
Add xtd::registry and uncomment lines.