Create a Registry key (VBScript)
This code can be found in
Chapter 9 of Windows XP Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' From the book, "Windows XP Cookbook"
' ISBN: 0596007256
' ------ SCRIPT CONFIGURATION ------
const HKLM = &H80000002
strKeyPath = "<RegKey>" ' e.g. Software\Rallencorp
strComputer = "<ComputerName>" ' e.g. wks01 (use "." for local computer)
' ------ END CONFIGURATION ---------
set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
intRC = objReg.CreateKey(HKLM, strKeyPath)
if intRC <> 0 then
WScript.Echo "Error creating key: " & intRC
else
WScript.Echo "Successfully created key " & strKeyPath
end if
' This code deletes a Registry key.
' ------ SCRIPT CONFIGURATION ------
const HKLM = &H80000002
strKeyPath = "<RegKey>" ' e.g. Software\Rallencorp
strComputer = "<ComputerName>" ' e.g. wks01 (use "." for local computer)
' ------ END CONFIGURATION ---------
set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
intRC = objReg.DeleteKey(HKLM, strKeyPath)
if intRC <> 0 then
WScript.Echo "Error deleting key: " & intRC
else
WScript.Echo "Successfully deleted key " & strKeyPath
end if
|
This code has been viewed 9600 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|