How to Create a Script Text File to Edit the Registry in Windows XP
Visual Basic Scripting (VBScript) allows you to create script files that automate processes on a computer, including the automation of registry edits. VBScript files are typically used by network administrators to edit computer registries without manually editing each computer one-by-one. VBScript has a "WMI" class that contains the methods and properties used to edit the Windows registry. You can add or edit registry values in VBScript.
Instructions
-
-
1
Navigate to the Windows "Start" and select "All Programs," "Accessories" and "Notepad." The Notepad application opens, where you can type your VBScript code.
-
2
Create the WMI object that contains the methods to edit the registry by typing the following code to create the WMI object:
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set registry =GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
-
-
3
Create a new key. You can edit, delete or add a registry key. In this example, a new registry key is created. Type the following code:
registry.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\MyNewKey"
Replace "MyNewKey" with the name of your new registry key.
-
4
Press the "Ctrl" and "S" keys simultaneously to open the "Save As" dialog. Type "registry.vbs" (without quotes) in the "File Name" text box. The "VBS" file extension allows you to execute the code, so Windows doesn't open it as text.
-
5
Double-click the file on your desktop. A command line window opens and the new registry key is added to the registry.
-
1
Tips & Warnings
Backup your registry before modifying it.