I'm trying to return the value of the "Enviroment Path" from the registry.
Does anyone have any sample code that can do this? If you can write to the path as well it would be handy?
Printable View
I'm trying to return the value of the "Enviroment Path" from the registry.
Does anyone have any sample code that can do this? If you can write to the path as well it would be handy?
VB Code:
Private Sub Command1_Click() Dim WshShell As Object Set WshShell = CreateObject("wscript.Shell") WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\test", "Testvalue", "REG_SZ" Set WshShell = Nothing End Sub
That is all
Seahag
Thanks SeaHag,
I tried the code you sent me but I get this error:
<Object variable or With block variable not set>
Do you have any idea what I'm doing wrong? Do I need to reference anything?
Regards
Stinker
Where do you get that line? I tested it and worked Ok.
you shouldnt need a reference..
Werks for mee to.. I tested before i posted...
What windows are u using? (i dont think it matters...but)
MMMmmm yeah that might be the problem. I'm running 2000. I don't actually have a Envonment path in my NKEY_Local_Machine. I do have one in my HKEY_Current_User & HKEY_Users.
Do I just need to change it to HKCU or HKU?
No, that should not be the problem.... I'm running W2K as well.
Can you actually see the property in your registry?
I'm running VB6. You guys arnt on an earlier version are you?
heres a snap shot
I am running the same things u are..
Did you cut and past the code.. If soo mak sure you
got all of it..
It should werk right out of the box.
Seahag
Thanks guys youve both been great. Its working now. Don't know why it wasnt before but I've come back from dinner without changing a thing and its ok. Must be the pasta.
Thanks again
Stinker
mmmmmm ... pasta
Sure... Pasta is always the solution. Pasta rules!!Quote:
Originally posted by Stinker
Thanks guys youve both been great. Its working now. Don't know why it wasnt before but I've come back from dinner without changing a thing and its ok. Must be the pasta.
Thanks again
Stinker