使用c#设置cmd变量 [英] set cmd variable using c#
本文介绍了使用c#设置cmd变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我可以在cmd中设置变量
set xx = 10 >
然后如果我按下set命令然后我就能看到那个变量。
现在我想用变量设置C#。任何人都可以告诉我该怎么做吗?
我也试过
hello
I can Set variable in cmd by
set xx=10
then If I press set command then I can see that variable.
Now I want to set that variable using c#. Can any body tell me how to do that?
I had also tried
Environment.SetEnvironmentVariable("xx", "10");
但没有奏效。
But not worked.
推荐答案
它确实有效,但变量不会导出到任何其他命令窗口。它只存在于该应用程序的环境中。
It does work, but the variable is not exported to any other command window. It only exists within the environment of that application.
这篇关于使用c#设置cmd变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文