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

◆ environment_variables() [2/2]

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

Gets search paths for files, directories for temporary files, application-specific options, and other similar information.

Returns
std::map<xtd::ustring, xtd::ustring> A string dictionary that provides environment variables that apply to this process and child processes. The default is empty.
Remarks
Although you cannot set the xtd::diagnostics::process_start_info::environment_variables property, you can modify the generic dictionary returned by the property. For example, the following code adds a TempPath environment variable:
my_process.startInfo().environment_variables().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_variables 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.