[This is preliminary documentation and subject to change.]
The RegWrite method sets the registry key or value named by strName.
WshShell.RegWrite strName, anyValue, [strType]
StrName must begin with one of following root key names:
| Short | Long |
| HKCU | HKEY_CURRENT_USER |
| HKLM | HKEY_LOCAL_MACHINE |
| HKCR | HKEY_CLASSES_ROOT |
| HKEY_USERS | |
| HKEY_CURRENT_CONFIG |
RegWrite supports strType as REG_SZ, REG_EXPAND_SZ, REG_DWORD and REG_BINARY. If another data type is passed as strType, RegWrite returns E_INVALIDARG.
RegWrite automatically converts anyValue to a string when strType is REG_SZ or REG_EXPAND_SZ. If strType is REG_DWORD, anyValue is converted to an integer. If strType is REG_BINARY, anyValue must be an integer.
Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.RegWrite "HKCU\ScriptEngine\Value", "Some string value"
WshShell.RegWrite "HKCU\ScriptEngine\Key\", 1 "REG_DWORD"
WshShell.RegDelete method, WshShell.RegWrite method
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.