Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add new Path to the path variable in Registry

Status
Not open for further replies.

newtoclarion

Programmer
Jul 20, 2011
66
SA
Hello All

I am trying to add a new path to "Path environment variable". (actually I want to add the path regardless the method)

my code retrieved the path correctly but it fails to update the path, even I tried to create a new variable in the registry but also failed.

Code:
Reg_pth1                 CSTRING(255)
Reg_pth                  CSTRING(255)

code
 Reg_pth = GETREG(REG_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','path')
 Reg_pth1 = Reg_pth & ';c:\00'
 if PUTREG(REG_LOCAL_MACHINE,'SYSTEM\CurrentControlSet\Control\Session Manager\Environment','path',Reg_pth1)
    stop('not added')
 end

Best Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top