All Forums >> [Scripting] >> WSH & Client Side VBScript >> Reading a string that has a slash in it... Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
I have this simple script, where I want to read the registry and return what is inside there.
quote:
Set WSHShell = CreateObject("WScript.Shell") Dim RegKey, String
RegKey = "HKCU\Software\ASoftware\ConfigList\MySettings\" String = WSHShell.RegRead(RegKey & "xyz\abc") WScript.echo "The string in this is: " & string
But it's not working - it just returns an error message of "Invalid root in registry key" 80070002
However if I rename the registry name from xyz\abc to xyz it works OK. But the software I am using is hardcoded (I didn't make it) to use xyz\abc so I need to read that and output whatever is in there.
I have tried
quote:
String = WSHShell.RegRead(RegKey & ""xyz\abc"")
quote:
String = WSHShell.RegRead(RegKey & "xyz\\abc")
quote:
String = WSHShell.RegRead(RegKey & ""xyz\\abc"")
None of them worked.
When I exported this bit of registry, it looks like this
quote:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\ASoftware\ConfigList\MySettings] "xyz\\abc"="value"
Any suggestions?
Thanks,
Tony
< Message edited by tsutton -- 5/30/2007 7:39:42 PM >