|
-
Mar 20th, 2002, 01:05 PM
#1
Thread Starter
New Member
Enviroment Path in Registry
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?
-
Mar 20th, 2002, 01:56 PM
#2
Fanatic Member
This`ll do
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
-
Mar 20th, 2002, 03:38 PM
#3
Thread Starter
New Member
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
-
Mar 20th, 2002, 03:44 PM
#4
-
Mar 20th, 2002, 03:51 PM
#5
Fanatic Member
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)
-
Mar 20th, 2002, 04:11 PM
#6
Thread Starter
New Member
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?
-
Mar 20th, 2002, 04:14 PM
#7
-
Mar 20th, 2002, 04:18 PM
#8
Thread Starter
New Member
Can you actually see the property in your registry?
-
Mar 20th, 2002, 04:28 PM
#9
Thread Starter
New Member
I'm running VB6. You guys arnt on an earlier version are you?
-
Mar 20th, 2002, 04:28 PM
#10
-
Mar 20th, 2002, 04:32 PM
#11
Fanatic Member
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
-
Mar 20th, 2002, 04:38 PM
#12
Thread Starter
New Member
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
-
Mar 20th, 2002, 04:39 PM
#13
Fanatic Member
-
Mar 20th, 2002, 04:41 PM
#14
Need-a-life Member
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
Sure... Pasta is always the solution. Pasta rules!!
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|