Home > Archive > VBScript > November 2004 > regread with curly braces in registry path
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
regread with curly braces in registry path
|
|
| cdrees@gmail.com 2004-11-23, 3:56 pm |
| Does anyone have a solution for doing a regread in vbscript, when the
path contains curly braces?
I can't get my vbscript to work when the curly braces are present..
An example path:
HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Locat
ion
Profiles\Services\{1E6CEEA1-FB73-11CF-BD76- 00001B27DA23}\Teller\Tab2\DefaultUserNam
e
Here is the script that isn't working:
keyname3 = " HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Locat
ion
Profiles\Services\" &brStart &"1E6CEEA1-FB73-11CF-BD76-00001B27DA23"
&brEnd &"\Teller"
validate20 = bjShell.RegRead(keyname3 & "\Tab2\DefaultUserName")
if validate20 = "" then
validate20 = "No Value Set"
wscript.echo validate20
Else
wscript.echo validate20
end if
Thanks very much!!
Please, if possible, respond to christopher.rees@yesbank.com in
addition to here - as I don't get a chance to check here very often.
| |
| y sakuda 2004-11-23, 3:56 pm |
| <cdrees@gmail.com> wrote in message news:1101223150.433545.193570@z14g2000cwz.googlegroups.com...
> Does anyone have a solution for doing a regread in vbscript, when the
> path contains curly braces?
>
> I can't get my vbscript to work when the curly braces are present..
>
> An example path:
>
> HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Locat
ion
> Profiles\Services\{1E6CEEA1-FB73-11CF-BD76- 00001B27DA23}\Teller\Tab2\DefaultUserNam
e
>
>
> Here is the script that isn't working:
> keyname3 = " HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Locat
ion
> Profiles\Services\" &brStart &"1E6CEEA1-FB73-11CF-BD76-00001B27DA23"
> &brEnd &"\Teller"
> validate20 = bjShell.RegRead(keyname3 & "\Tab2\DefaultUserName")
> if validate20 = "" then
> validate20 = "No Value Set"
> wscript.echo validate20
> Else
> wscript.echo validate20
> end if
>
I's Ok to read key with {} like this.
Set WS=CreateObject("Wscript.Shell")
wRegkey=WS.RegRead("HKEY_CLASSES_ROOT\CLSID\{00000010-0000-0010-8000-00AA006D2EA4}\")
wscript.echo wRegKey
I suppose you must change brStart to "{" and brEnd to "}"
VBS not support constant like that.
Y Sakuda from JPN
| |
| cdrees@gmail.com 2004-11-24, 3:55 pm |
| Thanks for the reply...
My example was probably not the best one.... I had just the { }
braces in there previously, and replaced them with variables I defined
further up in the script, and forgot to take them out when I copied and
pasted into the example... It didn't work either way for me.
This is what I am doing currently, which isn't working for me...
Set objShell = WScript.CreateObject("WScript.Shell")
keyname = " HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Locat
ion
Profiles\Services\{1E6CEEA1-FB73-11CF-BD76-00001B27DA23}\Teller"
validate18 = bjShell.RegRead(keyname & "\Tab1\Tree")
if validate18 = "" then
validate18 = "No Value Set"
wscript.echo validate18
Else
wscript.echo validate18
end if
Any help is appreciated!!
Thanks :)
-Chris
y sakuda wrote:
> <cdrees@gmail.com> wrote in message
news:1101223150.433545.193570@z14g2000cwz.googlegroups.com...
the[color=darkred]
Profiles\Services\{1E6CEEA1-FB73-11CF-BD76- 00001B27DA23}\Teller\Tab2\DefaultUserNam
e[color=darkred]
&"1E6CEEA1-FB73-11CF-BD76-00001B27DA23"[color=darkred]
> I's Ok to read key with {} like this.
>
> Set WS=CreateObject("Wscript.Shell")
>
wRegkey=WS.RegRead("HKEY_CLASSES_ROOT\CLSID\{00000010-0000-0010-8000-00AA006D2EA4}\")
> wscript.echo wRegKey
>
> I suppose you must change brStart to "{" and brEnd to "}"
> VBS not support constant like that.
> Y Sakuda from JPN
| |
| y sakuda 2004-11-24, 3:55 pm |
| <cdrees@gmail.com> wrote in message news:1101308284.552597.167490@f14g2000cwb.googlegroups.com...
> Thanks for the reply...
>
> My example was probably not the best one.... I had just the { }
> braces in there previously, and replaced them with variables I defined
> further up in the script, and forgot to take them out when I copied and
> pasted into the example... It didn't work either way for me.
>
> This is what I am doing currently, which isn't working for me...
>
> Set objShell = WScript.CreateObject("WScript.Shell")
> keyname = " HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Locat
ion
> Profiles\Services\{1E6CEEA1-FB73-11CF-BD76-00001B27DA23}\Teller"
> validate18 = bjShell.RegRead(keyname & "\Tab1\Tree")
> if validate18 = "" then
> validate18 = "No Value Set"
> wscript.echo validate18
> Else
> wscript.echo validate18
> end if
>
I have'nt that software,so I can't test your code.
Anyway I suppose that is unrelevant to {}.
Please check KeyName and ValueName.
I think best way is copy keyname from Registry Editor and paste to script.
(right click key and select copy keyname)
Y sakda from JPN
|
|
|
|
|