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

◆ environment() [1/2]

const std::map< xtd::ustring, xtd::ustring > & xtd::diagnostics::process_start_info::environment ( ) const
noexcept

Gets the environment variables that apply to this process and its child processes.

Returns
std::map<xtd::ustring, xtd::ustring> A generic dictionary containing the environment variables that apply to this process and its child processes.
Remarks
The environment variables contain search paths for files, directories for temporary files, application-specific options, and other similar information. Although you cannot directly set the xtd::diagnostics::process_start_info::environment property, you can modify the generic dictionary returned by the property. For example, the following code adds a TempPath environment variable:
my_process.start_info().environment().insert({"TempPath", "C:\\Temp"}); 
. You must set the xtd::diagnostics::process_start_info::use_shell_execute property to false to start the process after changing the xtd::diagnostics::process_start_info::environment property. If xtd::diagnostics::process_start_info:use_shell_execute is true, an xtd::invalid_operation_exception is thrown when the xtd::diagnostics::process::start method is called.
An applications, using the xtd::diagnostics::process_start_info::environment property is the same as using the xtd::diagnostics::process_start_info::environment_variables property.