locked
怎么用VBS访问Windows7注册表 RRS feed

  • 问题

  • Script: D:\Test\init.vbs
    Line:  6

    Char: 1
    Error: Invalid root in registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet001\Control\Session

    Manager\Environment\".
    Code: 80070005 (Access Denied)
    Source: WshShell.RegWrite

    --------------------------------

    myPath = "this is my path"

    Set WshShell = WScript.CreateObject("WScript.Shell")
    RegPath = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\"
    WshShell.RegWrite RegPath & "myPath", myPath, "REG_SZ"

     

    2011年11月22日 9:17

答案