http://msdn.microsoft.com/en-us/library/aa384906(v=vs.85).aspx
HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set ObjRegistry = _
GetObject("winmgmts:{impersonationLevel = impersonate}!\\" _
& strComputer & "\root\default:StdRegProv")
strPath = "SOFTWARE\MyKey\MySubKey"
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 _
& "HKLM\SOFTWARE\MYKey\"
End If
浙公网安备 33010602011771号