.RegWrite

Write a value to the Registry

Syntax 
      objShell.RegWrite strRegName, anyValue, [strType]

Arguments:

   objShell   A WScript.Shell object

   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, 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.

Examples

Hide hidden and system files in Windows Explorer:

Set WshShell = CreateObject("WScript.Shell")
myKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
WshShell.RegWrite myKey,0,"REG_DWORD"
Set WshShell = Nothing

Display hidden and system files in Windows Explorer:

Set WshShell = CreateObject("WScript.Shell")
myKey = "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Hidden"
WshShell.RegWrite myKey,1,"REG_DWORD"
Set WshShell = Nothing

“Nothing is permanent” - Buddha

Related:
Registry, delete - WshShell.RegDelete
Registry, read - WshShell.RegRead
Equivalent Windows CMD command: REG - Read, Set or Delete registry keys and values
Equivalent Powershell command: Set-Item


© Copyright SS64.com 1999-2013
Some rights reserved