WshShell.RegWrite

Read a value from the Registry

Syntax 
      WshShell.RegWrite strRegName, anyValue, [strType]

Arguments:

         strRegName : 
         To set a key instead of a value terminate strRegName 
         with a backslash character \

         strRegName must start with one of

         HKCU
         HKEY_CURRENT_USER
         HKEY_USERS
         HKLM
         HKEY_LOCAL_MACHINE
         HKCR
         HKEY_CLASSES_ROOT
         HKEY_CURRENT_CONFIG

         strType :
         The data type can be optionally specified as one of
         REG_SZ, REG_EXPAND_SZ, (String values)
         REG_DWORD  (convert to Integer value)
         REG_BINARY (Integer value)

When you specify a key-name (as opposed to a value-name),
RegRead returns the default value. 

Example

Set WshShell = Wscript.CreateObject("Wscript.Shell")
WshShell.RegWrite "HKCU\Control Panel\Desktop\IconTitleFaceName", "MS Sans Serif"
WshShell.RegWrite "HKCU\ScriptEngine\Key\", 1 "REG_DWORD" 

Related commands:

Registry, delete - WshShell.RegDelete
Registry, read - WshShell.RegRead

Equivalent Windows NT command:

REG - Read, Set or Delete registry keys and values



Back to the Top

Simon Sheppard
SS64.com