VBScript

http://msdn.microsoft.com/en-us/library/aa384906(v=vs.85).aspx

HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set ObjRegistry = _
    GetObject("winmgmts:{impersonationLevel = impersonate}!\" _
    & strComputer & "
ootdefault:StdRegProv")

strPath = "SOFTWAREMyKeyMySubKey"

Return = objRegistry.CreateKey(HKEY_LOCAL_MACHINE, strPath)

If Return <> 0 Then
    WScript.Echo "The operation failed." & Err.Number
    WScript.Quit
Else
    wScript.Echo "New registry key created" & VBCRLF _
        & "HKLMSOFTWAREMYKey"

End If

  

原文地址:https://www.cnblogs.com/sskset/p/3456231.html