简体   繁体   English

在VS12 C#中设置环境变量

[英]Set environmental variable in VS12 C#

I want to apply the following fix: click me but I don't find how or where to set this. 我想应用以下修复程序: 单击我,但找不到如何或在何处进行设置。 all I found is something with the command, but when I enter this in cmd it doesn't work.. 所有我发现是一些与命令,但是当我在cmd中输入这个不工作..

Isn't there a simple file where I could edit this variable? 没有一个可以编辑此变量的简单文件吗? Or a way to do it in the GUI? 还是在GUI中做到这一点的方法?

To programmatically change an Environment variable from within your application, you can use one of the following three commands: 要以编程方式从应用程序中更改环境变量,可以使用以下三个命令之一:

Setting the environment variable for only the current process: 仅为当前进程设置环境变量:

Environment.SetEnvironmentVariable("<VarName>", "<VarValue>", EnvironmentVariableTarget.Process);

Setting the environment variable for the current user: 为当前用户设置环境变量:

Environment.SetEnvironmentVariable("<VarName>", "<VarValue>", EnvironmentVariableTarget.User);

Setting the environment variable for the entire system: 设置整个系统的环境变量:

Environment.SetEnvironmentVariable("<VarName>", "<VarValue>", EnvironmentVariableTarget.Machine);

Additional information on Environment.SetEnvironmentVariable() with examples. 有关Environment.SetEnvironmentVariable()附加信息,以及示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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