Home NT WSH
WshShell.RegWrite

Write a value to 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

         HKEY_CURRENT_USER  or HKCU
         HKEY_USERS         
         HKEY_LOCAL_MACHINE or HKLM
         HKEY_CLASSES_ROOT  or HKCR
         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" 

"Nothing is permanent" - Buddha

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