Link to home
Start Free TrialLog in
Avatar of schiu_ca
schiu_ca

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of RobSampson
RobSampson
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of schiu_ca
schiu_ca

ASKER

Hi Rob
The script worked great. I just needed to declare objshell at line 12.
        Set objShell = WScript.CreateObject("WScript.Shell")

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

Regards,

Rob.