locked
Problem while running a script RRS feed

  • Question

  • When I am trying to run my vbscript, I am getting the below issue.

     WshShell.RegRead: Invalid root in registry key "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App paths\winzip32.exe\"

    Can some one help me out?

     

    Thursday, January 31, 2013 3:34 PM

Answers

  • Hi,

    did you check that the path exists on your system? That error occurs if you don't have the key given there. I tried it and it worked fine on my system. My Test-Script was:
    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WScript.Echo WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App paths\WRITE.EXE\")

    And I got exactly the same error message when I modified it e.g. ...\WRITEX.EXE\ so it does not exist.

    With kind regards,

    Konrad

    Thursday, January 31, 2013 3:47 PM
  • Hi,

    the ending is important. If you just safe a core VBS script in a file then simply safe it with an eding on vbs. So rename your file to new.vbs and start it with cscript new.vbs

    You can also use an ending of wsf but then you have to write the file different:

    An example of a wsf file could be:

    <job id="NewScript">
    <script language="VBScript">
    'Put your vb script in here
    </script>
    </job>

    But what I meant was that you should check with regedit that the given key really exist. The error message simply says that you do not have such a key on your system.

    With kind regards,

    Konrad

    Thursday, January 31, 2013 7:30 PM
  • Follow up questions should be asked in The Official Scripting Guys Forum!

    Karl

    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    Friday, February 8, 2013 8:52 PM

All replies

  • Hi,

    did you check that the path exists on your system? That error occurs if you don't have the key given there. I tried it and it worked fine on my system. My Test-Script was:
    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WScript.Echo WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App paths\WRITE.EXE\")

    And I got exactly the same error message when I modified it e.g. ...\WRITEX.EXE\ so it does not exist.

    With kind regards,

    Konrad

    Thursday, January 31, 2013 3:47 PM
  • Hi,

    I am new to programming and scripting so I am not exactly sure what to do.

    So I copied the below code in a notepad and stored it as new.wsf

    Dim WshShell
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WScript.Echo WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App paths\winzip32.exe\")

    From the cmd prompt, I executed

    cscript new.wsf

    But I get it as :

    C:\Documents and Settings\Administrator\Desktop>cscript new.wsf
    Microsoft (R) Windows Script Host Version 5.7
    Copyright (C) Microsoft Corporation. All rights reserved.
    C:\Documents and Settings\Administrator\Desktop\new.wsf(0, 1) Windows Script Host: No jobs are defined in the file
    C:\Documents and Settings\Administrator\Desktop>

    Hope you can help me, what should be my next step.
    Thursday, January 31, 2013 4:06 PM
  • Ask here: http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/threads

    Thanks!


    Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Thursday, January 31, 2013 7:30 PM
  • Hi,

    the ending is important. If you just safe a core VBS script in a file then simply safe it with an eding on vbs. So rename your file to new.vbs and start it with cscript new.vbs

    You can also use an ending of wsf but then you have to write the file different:

    An example of a wsf file could be:

    <job id="NewScript">
    <script language="VBScript">
    'Put your vb script in here
    </script>
    </job>

    But what I meant was that you should check with regedit that the given key really exist. The error message simply says that you do not have such a key on your system.

    With kind regards,

    Konrad

    Thursday, January 31, 2013 7:30 PM
  • Follow up questions should be asked in The Official Scripting Guys Forum!

    Karl

    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer



    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})

    Friday, February 8, 2013 8:52 PM