I am wondering if I can use VB.NET(I am using visual studio 2010 express) to get and set a environment variable.
I want to add path of my application on system environment. I want to preserve what is already there and then I wan to add my string.
This can be done by getting value of PATH and then append my string then re writing it.
I have 2 questions here:
- How to get/set system variable in vb.net 2010?
- Will it be on the fly, I mean will it be immediatly avaialble in dos prompt or there will be delay?
As just for experiment i opened a command prompt then updated the PATH variable manually and it was not updated. I am wondering it I do it through programe it will be same.
I hope i stated my problem clearly, please feel free to comment to ask if need more clarity.
You can use following methods:
Environment-Methods: http://msdn.microsoft.com/en-us/library/yat6s6yb.aspx
Also note the optional third parameter in:
Possible values are: Machine, Process and User
http://msdn.microsoft.com/en-us/library/system.environmentvariabletarget.aspx