Subject: Appending to PATH environment variable
Posted By: jacob Post Date: 2/7/2004 5:00:24 AM
Well, I don't quite get it! I am trying to apend to the environment variable PATH using C#, however some things related to this is difficult to find an answer for!

I can retrieve the value of the PATH in two ways, either using direct access to the Windows registry using the RegistryKey class, or using the Environment.GetEnvironmentVariable method. In both cases I will get the expanded value; that is where the %SystemRoot% has been replaced by the actual value. I thought that the method Environment.ExpandEnvironmentVariables was exactly for this purpose!

So the thing is that I can't seem to get the raw value out of the registry, and I need that for writing the new value, since otherwise I would loose the wildcards! How do I do this? Or is there a smarter way of appending to the PATH variable, without doing all this work (checking existency, string concatenation etc.)?

Moreover I have heard that you need to do some kind of broadcast after setting the new variable, something about letting other programs know of the changes! How do I do this, and is there a smart way to do this in C#?

Thanks

Jacob.

Reply By: jacob Reply Date: 2/9/2004 9:43:06 AM
I still haven't found the answer. Please help me! I have found this page that more or less describes the functionality that I would like, however the URL is telling me that it is not implemented yet...

http://longhorn.msdn.microsoft.com/lhsdk/ref/ns/microsoft.win32/e/registryvaluekind/registryvaluekind.aspx



There must be a way!?

Jacob.

Go to topic 9495

Return to index page 953
Return to index page 952
Return to index page 951
Return to index page 950
Return to index page 949
Return to index page 948
Return to index page 947
Return to index page 946
Return to index page 945
Return to index page 944