How to Edit the Registry in VBScript
VBScript files are plain text files written in a language similar to Visual Basic. VBScript is a simpler language that allows you to change system settings on your computer. VBScript file execution allows you to change the settings in the registry. The Windows registry has all the settings for a computer including device drivers, desktop permissions and program defaults. You can create, delete and edit registry keys using the VBScript language.
Instructions
-
-
1
Click the Windows "Start" button and select "All Programs." Click "Accessories" and then click "Notepad." This is a free text editor used to create VBScript files.
-
2
Create a registry object. The registry object is a variable that contains all the functions and properties for your system registry. Enter the following code into the Notepad window:
Set registry =GetObject( "winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
-
-
3
Set up the registry key value. In this example, a registry key is created. You must specify the key name you want to edit, delete or create. The following code creates a registry key file:
key = "SOFTWARE\MyNewKey"
-
4
Call the function to create your registry key. The object you created early is used to execute the functions to change the registry keys. In this example, the "CreateKey" function is used. Enter the follow code to make changes to the registry:
registry.CreateKey HKEY_LOCAL_MACHINE,key
-
5
Click the Notepad "File" menu item and then click "Save As." Enter "registry.vbs" into the file name text box and select "All Files" from the "File Type" drop-down. Click "Save" to save the file to your hard drive. To test the new file, double-click it. The file executes and creates the key in the Windows registry.
-
1
References
- Photo Credit computer image by blaine stiger from Fotolia.com