Registry Read 
Author Message
 Registry Read

Hi,

does anyone have experience reading registry keys with VBS which contain
backslashes ("\") in den name of the value? How I have to enter them so the
script engine interprests them as names of a value an not as another subkey?

e.g. under "HKLM\SYSTEM\MountedDevices\\DosDevices\C:", how do I access the
value of "\DosDevices\Y:"?

Thanks for your help!



Fri, 16 Jul 2004 20:54:59 GMT  
 Registry Read

Quote:

> does anyone have experience reading registry keys with VBS which contain
> backslashes ("\") in den name of the value? How I have to enter them so the
> script engine interprests them as names of a value an not as another subkey?

> e.g. under "HKLM\SYSTEM\MountedDevices\\DosDevices\C:", how do I access the
> value of "\DosDevices\Y:"?

Hi

WSH registry functions is a kind of a Mickey Mouse implementation ;-), and
backslash in registry keys\values is a known issue in WSH.

Some workarounds (from VBScript):

A)
You can use Shell.run regedit.exe to export to a registry file and then parse
the file:

REGEDIT /E filename3 [regpath1]
REGEDIT  /E:A filename3 [regpath1]
REGEDIT  /A filename3 [regpath1]

  /E filename3
  Specifies the file to export the registry to.

  /E:A and /A
  Specifies ASCII output for W2k/WXP (default Unicode)

  regpath1
  Specifies the starting registry key to export from.
  (Defaults to exporting the entire registry).

B)
Use WMI's StdRegProv (Standard Registry Provider). WMI comes default with
W2k/WXP, can be installed on W9x/WNT.

WMI Class StdRegProv:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmis...

C)
Install RegObj.dll that represents the registry via an object model with methods
to enumerate keys/values (and a lot more). RegObj.dll is a free, unsupported dll
from MS.

You can get RegObj.dll from:
Win32 Scripting [Clarence Washington]
http://cwashington.netreach.net/main/tools/default.asp?topic=n-z

You can use a wrapper (encapsulate_regobj.zip) from
http://cwashington.netreach.net  to get it more "user friendly". You can also
find a couple of sample scripts which demonstrate how to enumerate there.

D)
Use a 3. party component for it:
Eg. http://www.jsware.net/jsware/scripts.html (JSSys.DLL)

--
torgeir



Sat, 17 Jul 2004 01:41:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Still struggling with registry reading.....can anyone help?

2. Registry: reading subkey names in VBScript

3. Registry Read

4. Registry Reading

5. Registry : Read method

6. WMI registry read by key

7. Help wanted with ASP and Registry reads

8. Registry Read Question

9. Enumerated Registry Read/Write/Delete Object

10. Registry Reading and such

11. Still struggling with registry reading.....can anyone help?

12. Slow Registry Read

 

 
Powered by phpBB® Forum Software