We help IT Professionals succeed at work.

How to Modify( & Add new) System Environment Variables in WinNT/2000, Such as 'path','classpath','temp' <br>etc...

bruce_luo
bruce_luo asked
on
How to Modify( & Add new) System Environment Variables in WinNT/2000, Such as 'path','classpath','temp' etc...

regards,

Bruce L.
Comment
Watch Question

Commented:
Look in the registry for this

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment


The Crazy One
Commented:
Something like this

procedure TForm1.SetKey;
var
     Reg: TRegistry;
begin
     Reg := TRegistry.Create;
     try
          Reg.RootKey := HKEY_LOCAL_MACHINE;
          if Reg.OpenKey('\SYSTEM\CurrentControlSet\Control\Session Manager\Environment', False)
               then Reg.WriteString('Path', 'C:\Development\Delphi\Bin');
     finally
          Reg.CloseKey;
          Reg.Free;
     end;
end;

Author

Commented:
Oops, so stupid question ...

thank you.

Bruce L.

Commented:
You might have to look under the subsets such as

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Session Manager\Environment

etc.

Commented:
That was fast. :>)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.