registry question

G

Guest

Hi all
I am retrieving the value of the Environment path variable
from registry key
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Sessio
n Manager\Environment

I notice that there is also other keys like
ControlSet001, ControlSet002 etc. What is the difference
between all these?

Is using the CurrentControlSet key the most reliable?
Thanks for all your valuable replies.
 
N

Nicholas Paldino [.NET/C# MVP]

You shouldn't use the registry. Rather, use the static
GetEnvironmentVariable method on the Environment class.

The ControlSet001, etc, etc keys are for other boot configurations that
are on your system.

Hope this helps.
 
G

Guest

Thanks Nicholas. I need to change the Path variable and
set it to some other value programmatically. There is
no .NET method for that. So, I am modifying the registry
key programmatically. Any other ideas?
-----Original Message-----
You shouldn't use the registry. Rather, use the static
GetEnvironmentVariable method on the Environment class.

The ControlSet001, etc, etc keys are for other boot configurations that
are on your system.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Hi all
I am retrieving the value of the Environment path variable
from registry key
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Sessio
n Manager\Environment

I notice that there is also other keys like
ControlSet001, ControlSet002 etc. What is the difference
between all these?

Is using the CurrentControlSet key the most reliable?
Thanks for all your valuable replies.


.
 
N

Nicholas Paldino [.NET/C# MVP]

In .NET 1.1 and before, you would want to call the
SetEnvironmentVariable API function through the P/Invoke layer.

In .NET 2.0 a static SetEnvironmentVariable method was attached to the
Environment class.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Thanks Nicholas. I need to change the Path variable and
set it to some other value programmatically. There is
no .NET method for that. So, I am modifying the registry
key programmatically. Any other ideas?
-----Original Message-----
You shouldn't use the registry. Rather, use the static
GetEnvironmentVariable method on the Environment class.

The ControlSet001, etc, etc keys are for other boot configurations that
are on your system.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Hi all
I am retrieving the value of the Environment path variable
from registry key
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Sessio
n Manager\Environment

I notice that there is also other keys like
ControlSet001, ControlSet002 etc. What is the difference
between all these?

Is using the CurrentControlSet key the most reliable?
Thanks for all your valuable replies.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top