General discussion

Locked

WSHShell.Read and Registry

By Dimitris ·
I have created the following script to read a value from a certain key from the Registry and disply it back.

Dim WSHShell, a
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Popup "Trying to read Paging File Size value'"
a = WSHShell.RegRead ("HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles")
WshShell.Popup "The current value is : " & a

However even though i have read the documentations, manuals, html pages and so on i have been unable to do it. I finally found the problem. The value i am trying to read is a REG_MULTI_SZ value. Thats why i get a type mismatch error. However the manuals say that RegRead does read this type of values. Anybody got an ideas how i can get round to it and read the value but most importantly display it?

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

WSHShell.Read and Registry

by gbworld In reply to WSHShell.Read and Registr ...

REG_MULTI_SZ is an array. As such, you need to loop through to find the values. Here is your script updated to get the correct answers:

Dim WSHShell, a, intLoop
Set WSHShell = WScript.CreateObject("WScript.Shell")
WSHShell.Popup "Trying to read Paging File Size value'"
a = WSHShell.RegRead ("HKLM\System\CurrentControlSet\Control\Session Manager\Memory Management\PagingFiles")
For intLoop = 0 to UBound(a)
WSHShell.Popup a(intLoop)
Next

Gregory A. Beamer
MCP: +I, SE, SD, DBA

Back to Web Development Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums