Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Importing Registry Settings

    Does anyone know if you can inport registry settings into a batchfile for use in installing software and stuff? And if anyone knows could you please explain how to as i ain't got a clue with registry stuff - Yet!

    Thanks in Advance
    Jambo

  2. #2
    Uranium Lounger viking33's Avatar
    Join Date
    Jun 2002
    Location
    Cape Cod, Massachusetts, USA
    Posts
    6,308
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Importing Registry Settings

    Jambo,
    IF:
    --------------------------------------------------
    i ain't got a clue with registry stuff - Yet!
    _________________________________

    I would suggest that if you ain't got a clue with registry yet, That you don't mess around with the registry until you DO have a clue.
    Be careful in the Reg ! <img src=/S/sorry.gif border=0 alt=sorry width=15 height=15>

    Bob
    BOB
    http://lounge.windowssecrets.com/S/flags/USA.gif http://lounge.windowssecrets.com/S/f...sachusetts.gif


    Long ago, there was a time when men cursed and beat on the ground with sticks. It was called witchcraft.
    Today it is called golf!

  3. #3
    Banned Member
    Join Date
    Jul 2002
    Location
    Newport Richey, Florida, USA
    Posts
    2,149
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    Viking is correct. The registry is not for the faint at heart. One wrong move and <img src=/S/bouncenburn.gif border=0 alt=bouncenburn width=31 height=31>

  4. #4
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    As viking and cowboy have both said,

    If you aren't comfortable with th registry, stay away from it.

    If you want to read a tale of woe by someone who was quite comfortable with the registry and managed to kill his laptop, have a look at <post#=204857>post 204857</post#>. It was written within hours of it happening

    It turns out that I couldn't recover any data from the HD. I lost about a month's worth of development. I toasted it but good <img src=/S/crybaby.gif border=0 alt=crybaby width=15 height=15>
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  5. #5
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    I think i came across wrong, i ain't afraid to tinker with the registry, i've been reading/writing VBA code from/to the registry for a while now but i just ain't got a clue how to do it from a .bat file! Any ideas!

    Jambo

  6. #6
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Long Beach, California, USA
    Posts
    1,912
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    You can always Export and Import to a .reg file, BUT... if you are comfortable with VBA, why not use VB or VBS to do this????? I don't think you can use a regular batch file...

  7. #7
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    i thought f doing that but would rather try to use a batch file first. I want to pull an install path of a game from the registry in order to patch the program's executable file! And guess what i went to try to do it with VB today and i can't remember how to, it's been a while since i've had to read somthing in from the registry, i'll have to ask in the VB forum, any ideas here though? i think u use the "GetSetting(appname, section, key[, default])" or "GetAllSettings(appname, section)" command but can't remember exactly and all my reference books are in work at the mo. any idea's anyone?

    Jambo

  8. #8
    5 Star Lounger
    Join Date
    Dec 2002
    Location
    Perth, Western Australia, Australia
    Posts
    730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    Not direct help to your problem. But re your ref books at work, I've found the command reference in the help for VBA comprehensive enough for most of my needs when I've had to stuff around with code. It gives full syntax and descriptions for both commands you quote. I assume the VB editor should have similar help. <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    <font face="Comic Sans MS" color="blue">TimOz</font>
    <img src=/S/flags/Finland.gif border=0 alt=Finland width=30 height=18> <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  9. #9
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    I have tried making sense of the VB Help but it ain't happening, it only helps with settings that have been wrote to the registry with VB. I have to read a path from the registry that have been wrote by other programs. Any idea's?

    Jambo

  10. #10
    5 Star Lounger
    Join Date
    Dec 2002
    Location
    Perth, Western Australia, Australia
    Posts
    730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    Getting out of my depth here, I thought you just wanted to check the correct syntax.

    But, if you do know the appname, section, etc, then regardless of what wrote the values to the registry, shouldn't VB be able to read them? If you don't know the appname, etc, then I've got no idea.
    <font face="Comic Sans MS" color="blue">TimOz</font>
    <img src=/S/flags/Finland.gif border=0 alt=Finland width=30 height=18> <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  11. #11
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Importing Registry Settings

    The answer is VBScript. See the following: <!post=Post #121209,121209>Post #121209<!/post>; <!post=Post #177457,177457>Post #177457<!/post>; <!post=Post #145958,145958>Post #145958<!/post>. Your target machine needs to have cscript.exe installed somewhere in the default path.

  12. #12
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Long Beach, California, USA
    Posts
    1,912
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    I don't think a batch file can READ the registry for you and MODIFY the registry. You want to use Visual Basic (or VBS) to do all of this.

    You have two options:

    1) RegRead and RegWrite (from Windows Script Host) -- in VB or VBS
    2) using the "API" -- only with VB

    For simple tasks, I just use the WSH "Reg" commands. For more complicated things, you need to use the API. I'll get you references on both... BUT, I think Jeff is right -- you should be using VBScript and not messing with the API.
    ___________________________

    OK, I like "devguru's" explanation of the WSH Shell commands:

    WshShell.RegRead
    WshShell.RegWrite

    Then, the MSDN gives you an overview here: Reading and Modifying the Windows Registry Through Visual Basic

    Quick and Dirty information on accessing and modifying the registry using the API is far more difficult to locate, but just to give you an idea of how it works:

    Accessing the Windows Registry with the API in Visual Basic
    MSKB - HOWTO: Use the Registry API to Save and Retrieve Setting

  13. #13
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    I haven't done this in a long time and this is from memory.

    If you use REGEDIT to export a hive from the registry into a .REG file, then open that file with WordPad, you will see what the file needs to look like. Then in the batch file, simply use the START batch file command to run a .REG file to import that data into the Registry.
    Legare Coleman

  14. #14
    Star Lounger
    Join Date
    Nov 2002
    Location
    Port Talbot, Wales
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    I don't want to modify the registry, only read a path from it! I am using VB 5 and have tried looking at the references in some of the above replys but i ain't come up with squat! Must be me, i think i'll ask one of my fellow I.T. ers in work on monday!

    Jambo

  15. #15
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing Registry Settings

    I don't think it is possible to read the registry from a BAT file.

    Why does it have to be from a bat file? What are you trying to do?
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •