The Window Registry stores settings and options for the Windows operating system (OS). This includes not just configurations for the OS itself, but also many configurations for hardware and software in the system. The Windows Registry consolidated the many configuration files (.ini) that were around before the 32-bit versions of Windows.
WARNING! Messing with the registry can seriously screw up your machine. Do not fiddle with it unless you know what you are doing.
The Windows Registry consists of name and data pairs (called values) arranged into a hierarchy of folders (called keys). The nomenclature is somewhat misleading because they are carry overs from Windows 3 ( the 16-bit version), when each key had only one string value. Now each key can actually hold multiple values or, in essence, an associative array.
There are several top level keys called hives which all begin with "HKEY". Parts of HKCU, HKLM, and HKU are structured similarly but apply in different scopes.
%SystemRoot%\System32\Config.
The values come in 12 different data types:
The typical user access the Windows Registry by running the regedit command, which opens up the Registry Editor. Win 9X had regedit.exe. Win NT and Win 2000 had regedit.exe and regedit32.exe. Win XP combined both versions into a new regedit.exe.
.REG files are text-based human readable files for handling potions of the Window Registry. The reg.exe utility tool can be run from the command line to maniuplate the Windows Registry as well as .REG files.
Here is an example of programmatically accessing the Windows Registry via Windows Script Host (WSH) using JavaScript/JScript.
var WshShell = WScript.CreateObject("WScript.Shell");
//Set/Create/Add key and its default value:
WshShell.RegWrite ("HKCU\\Software\\TEST\\MyKey\\", 1, "REG_BINARY");
//Set/Create/Add/Change value in a key:
WshShell.RegWrite ("HKCU\\Software\\TEST\\MyKey\\MyValue", "foobar", "REG_SZ");
//Get/Read default data of a key:
var bKey = WshShell.RegRead ("HKCU\\Software\\TEST\\MyKey\\");
//Get/Read data of a value:
WScript.Echo (WshShell.RegRead ("HKCU\\Software\\TEST\\MyKey\\MyValue"));
//Delete value:
WshShell.RegDelete ("HKCU\\Software\\TEST\\MyKey\\MyValue");
//Delete key:
WshShell.RegDelete ("HKCU\\Software\\TEST\\MyKey\\");
//Delete key:
WshShell.RegDelete ("HKCU\\Software\\TEST\\");
WSH can only write these data types: REG_SZ, REG_EXPAND_SZ, REG_BINARY, and REG_DWORD. WSH can only read these data types: REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_BINARY, and REG_DWORD.
Page Modified: (Hand noted: 2008-04-10 16:26:41Z) (Auto noted: 2008-04-10 21:31:03Z)