Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a reg key with a pathname (c:\windows\sys)

Status
Not open for further replies.

guru533

MIS
Aug 22, 2002
25
US
I have been having problems with creating a reg key with a path as its name and it is extremely furstrating. This is the key I am trying to create.

Path = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs\"
strReg1 = "C:\\Program Files\\Symantec\\SYMEVNT1.DLL"

If KeyExists (Path & StrReg1) = False Then
WSHShell.RegWrite Path & strReg1, "1"
End If

This script works if I don't name the regKey with a path (i.e. c:\program files) and just use the fileName (i.e. symenvt1.dll). So I'm guessing I'm doing something wrong with the forward slash marks, but I have tried it every which way and nothing works. This scripts creates sub-directories, instead of a regKey with a string name of "C:\\Program Files\\Symantec\\SYMEVNT1.DLL".

Any help would be appreciated. Thank you.
 
Here you go

const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs"

strValueName = "C:\\Program Files\\Sysmantec\\SYMEVNT1.DLL"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
Regards
Steve Friday
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top