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

◆ get_environment_variable() [2/2]

static xtd::ustring xtd::environment::get_environment_variable ( const xtd::ustring variable,
environment_variable_target  target 
)
static

Retrieves the value of an environment variable from the current process or from the Windows operating system registry key for the current user or local machine.

Parameters
variableThe name of an environment variable.
targetOne of the EnvironmentVariableTarget values.
Exceptions
std::invalid_argumenttarget is not a valid environment_variable_target value.
Returns
xtd::ustring The value of the environment variable specified by the variable and target parameters, or empty "" if the environment variable is not found.
Remarks
To retrieve all environment variables along with their values, call the xtd::environment::get_environment_variables method.
Environment variable names are case-sensitive on Linux and macOS but are not case-sensitive on Windows.
Todo:
Add xtd::registry and uncomment lines.