简体   繁体   中英

Set environment variables

Is there a way to set environment variables for an application so that whenever the process runs there wouldn't be no need to reset them. In fact, I'm writing a .NET applications' profiler and I need to set environment variables for a list of processes (I get the list from a config file). In other words, I previously know the processes to profile and I need to set the environment variables for them before they run

To work around this problem, use the interop services to set the environment variables. You can set an environment variable by using the Microsoft Platform Software Development Kit (SDK) SetEnvironmentVariable function.

System.Environment class does not have a method to set the environment variable for the current process

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM