Results 1 to 14 of 14

Thread: Enviroment Path in Registry

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    6

    Cool 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?

  2. #2
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901

    This`ll do

    VB Code:
    1. Private Sub Command1_Click()
    2. Dim WshShell As Object
    3. Set WshShell = CreateObject("wscript.Shell")
    4. WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\test", "Testvalue", "REG_SZ"
    5.  
    6. Set WshShell = Nothing
    7. End Sub

    That is all

    Seahag

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    6
    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

  4. #4
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    Where do you get that line? I tested it and worked Ok.
    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.

  5. #5
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    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)

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    6
    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?

  7. #7
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    No, that should not be the problem.... I'm running W2K as well.
    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.

  8. #8

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    6
    Can you actually see the property in your registry?

  9. #9

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    6
    I'm running VB6. You guys arnt on an earlier version are you?

  10. #10
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    heres a snap shot
    Attached Images Attached Images  

  11. #11
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    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

  12. #12

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    6

    Talking

    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

  13. #13
    Fanatic Member SeaHag's Avatar
    Join Date
    Jul 2001
    Location
    Lake Huron
    Posts
    901
    mmmmmm ... pasta

  14. #14
    Need-a-life Member Mc Brain's Avatar
    Join Date
    Apr 2000
    Location
    Buenos Aires, Argentina
    Posts
    6,808
    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
  •  



Click Here to Expand Forum to Full Width