how to use VBScript to access a registry key that contains '/'

I am trying to get the version number of Rtvscan from the registry.
The key is located in the registry folder  HKLM\Software\Intel\DLLUsage
The key is "C:\Program Files\Symantec AntiVirus\Rtvscan.exe"
I try to set up the registry path as "HKLM\Software\Intel\DLLUsage\VP6\C:\\Program Files\\Symantec AntiVirus\\Rtvscan.exe"
I got an error on the invalid registry key when the script is ran.

How do you quote "\" in the key?
'
' Check registry for Antivirus version number
dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
'
REgPath = "HKLM\Software\Intel\DLLUsage\VP6\C:\\Program Files\\Symantec AntiVirus\\Rtvscan.exe"
'
val = "NULL"
val = objShell.RegRead(RegPath)
' WScript.Echo val
ipos = InStr(1, val, "10.1.6010")
If ipos > 0 Then
   Call objShell.Run("cmd /c Echo .. > C:\Temp\VP6.flg")
End If

Open in new window

VBErr.bmp
schiu_caAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RobSampsonCommented:
The RegRead method is not capable of reading such values.  You will need to use the WMI Registry interface to read such values.  The code below will do the job for you.

Regards,

Rob.
' Check registry for Antivirus version number
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Intel\DLLUsage\VP6"
strValueName = "C:\Program Files\Symantec AntiVirus\Rtvscan.exe"
intReturn = objRegistry.GetStringValue(HKEY_LOCAL_MACHINE, strKeyPath, strValueName, val)
If IsNull(val) = False Then
	MsgBox val
	ipos = InStr(1, val, "10.1.6010")
	If ipos > 0 Then
	   Call objShell.Run("cmd /c Echo .. > C:\Temp\VP6.flg")
	End If
Else
	MsgBox "Could not find " & strKeyPath & "\" & strValueName
End If

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
schiu_caAuthor Commented:
Hi Rob
The script worked great. I just needed to declare objshell at line 12.
        Set objShell = WScript.CreateObject("WScript.Shell")

Thanks
0
RobSampsonCommented:
Ah, yes, I forgot that bit.  Thanks for the grade.

Regards,

Rob.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.