The RegWrite method writes a new entry into the registry.
The RegWrite method writes either a key or a value to the registry based on strName. If strName ends with a backslash (\), then RegWrite writes varValue to the registry as a key. Otherwise it writes varValue to the registry as a value. The strName parameter must begins with one of the following root key names:
Set WshShell =
WScript.CreateObject("WScript.Shell")
WshShell.RegWrite
"HKCU\MyNewKey\", 1 ,"REG_DWORD"
WshShell.RegWrite
"HKCU\MyNewKey\MyValue", "Hello world!"
WScript.Echo
WshShell.RegRead("HKCU\MyNewKey\MyValue")
WScript.Echo
WshShell.RegRead("HKCU\MyNewKey\")
WshShell.RegDelete
"HKCU\MyNewKey\MyValue"
WshShell.RegDelete
"HKCU\MyNewKey\"Hello World!
1This VBScript code writes a key/value pair into the registry, reads and displays their content, and finally removes them from the registry.