Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Reading a string that has a slash in it...

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,47759
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
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!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Reading a string that has a slash in it... - 5/30/2007 7:38:17 PM   
  tsutton

 

Posts: 4
Score: 0
Joined: 5/30/2007
Status: offline
Hi all, wondered if I could pick your brain...

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 >
 
 
Post #: 1
 
 RE: Reading a string that has a slash in it... - 5/30/2007 9:09:08 PM  1 votes
  ginolard


Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
Read it with WMI instead


      

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to tsutton)
 
 
Post #: 2
 
 RE: Reading a string that has a slash in it... - 5/30/2007 9:16:46 PM   
  tsutton

 

Posts: 4
Score: 0
Joined: 5/30/2007
Status: offline
That worked, thanks!

I'm VERY new with WMI - throw me the keywords/codes for registry writing with WMI and I'll get on with the research.

Thanks again.

(in reply to ginolard)
 
 
Post #: 3
 
 RE: Reading a string that has a slash in it... - 5/30/2007 9:34:28 PM   
  tsutton

 

Posts: 4
Score: 0
Joined: 5/30/2007
Status: offline
Sorted now... using the SetStringValue - works great. :D

I used this
http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&DisplayLang=en

to find the available code - very useful!

(in reply to tsutton)
 
 
Post #: 4
 
 RE: Reading a string that has a slash in it... - 5/30/2007 9:46:43 PM   
  ginolard


Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/

That site gives you, pretty much, every registry reading/writing script template you'll ever need.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to tsutton)
 
 
Post #: 5
 
 RE: Reading a string that has a slash in it... - 5/30/2007 9:51:08 PM   
  tsutton

 

Posts: 4
Score: 0
Joined: 5/30/2007
Status: offline
Thanks! Bookmarked. :D

(in reply to ginolard)
 
 
Post #: 6
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Reading a string that has a slash in it... Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts