VBscript problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

VBscript problem

yrdnaljcyrdnaljc Posts: 8Member
I am trying to read a registry key (win 2k and Win XP) using the regread function. Ultimately, I want to store all of the contents of the registry key in a file then compare it to another file to check for differences. I am start with small snipets of code to get a feel for what I need to do. The code attached will display a simple message box then will read a key from the registry and display it on my browser (IE). This is all I am trying to do at this point. The message box works but I see no text (registry key contents). I must be doing something wrong. All of the books I have been reading don't go into any real depth on this and hopefully someone can help.

Thanks in advance,

/**** code starts here ****/






My First Script.html




VBScript Demo



MsgBox "Click on OK to get registry data"

Dim wshshell, strResult
Set Wshshell = WScript.CreateObject("WScript.Shell")
Wsript.Echo WshShell.RegRead("hklmSOFTWARECompaqCIC")






/**** cod end ****/

CJ

Comments

  • HackmanCHackmanC Posts: 441Member
    I "suppose" that doesn't work because the security level of IE. (I hope that works that way..., or I will be very concerned, even when it runs from a file on my PC.). Only when that is an *.vbs file, only with code, and doesnt run on IE.

    --------
    : I am trying to read a registry key (win 2k and Win XP) using the regread function. Ultimately, I want to store all of the contents of the registry key in a file then compare it to another file to check for differences. I am start with small snipets of code to get a feel for what I need to do. The code attached will display a simple message box then will read a key from the registry and display it on my browser (IE). This is all I am trying to do at this point. The message box works but I see no text (registry key contents). I must be doing something wrong. All of the books I have been reading don't go into any real depth on this and hopefully someone can help.
    :
    : Thanks in advance,
    :
    : /**** code starts here ****/
    :
    :
    :
    :
    :
    :
    : My First Script.html
    :
    :
    :
    :
    :
    :

    VBScript Demo

    :
    :
    : MsgBox "Click on OK to get registry data"
    :
    : Dim wshshell, strResult
    : Set Wshshell = WScript.CreateObject("WScript.Shell")
    : Wsript.Echo WshShell.RegRead("hklmSOFTWARECompaqCIC")
    :
    :
    :
    :
    :
    :
    : /**** cod end ****/
    :
    : CJ
    :

    [red]Good luck![/red]
    [blue]Hackman[/blue]

  • yrdnaljcyrdnaljc Posts: 8Member
    I figured out why it doesn't run...the path I used "hklmSOFTWARECompaqCIC" is case sensitive. the hklm should be HKLM. Damn, I hate when small things like that tie me up for hours! Although, I won't be making that mistake again! Also, I should state that I downloaded the Windows Scripting environment from the MS web site. That way I am not relying on IE to run my script. Thanks for the reply Hackman!

    : I "suppose" that doesn't work because the security level of IE. (I hope that works that way..., or I will be very concerned, even when it runs from a file on my PC.). Only when that is an *.vbs file, only with code, and doesnt run on IE.
    :
    : --------
    : : I am trying to read a registry key (win 2k and Win XP) using the regread function. Ultimately, I want to store all of the contents of the registry key in a file then compare it to another file to check for differences. I am start with small snipets of code to get a feel for what I need to do. The code attached will display a simple message box then will read a key from the registry and display it on my browser (IE). This is all I am trying to do at this point. The message box works but I see no text (registry key contents). I must be doing something wrong. All of the books I have been reading don't go into any real depth on this and hopefully someone can help.
    : :
    : : Thanks in advance,
    : :
    : : /**** code starts here ****/
    : :
    : :
    : :
    : :
    : :
    : :
    : : My First Script.html
    : :
    : :
    : :
    : :
    : :
    : :

    VBScript Demo

    : :
    : :
    : : MsgBox "Click on OK to get registry data"
    : :
    : : Dim wshshell, strResult
    : : Set Wshshell = WScript.CreateObject("WScript.Shell")
    : : Wsript.Echo WshShell.RegRead("hklmSOFTWARECompaqCIC")
    : :
    : :
    : :
    : :
    : :
    : :
    : : /**** code end ****/
    : :
    : : CJ
    : :
    :
    : [red]Good luck![/red]
    : [blue]Hackman[/blue]
    :
    :

Sign In or Register to comment.