Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in WSH when trying to create WScript.Shell 1

Status
Not open for further replies.

cscott

Programmer
Feb 28, 2002
7
US
When I run:
<Script Language=&quot;vbscript&quot; >
Dim WshSHell
Set WshShell = CreateObject(&quot;Wscript.Shell&quot;)
WshSHell.run &quot;NOTEPAD.EXE&quot;,1,false
</Script>
I open notepad just fine BUT when I try:

<Script Language=&quot;vbscript&quot;>
Dim WshShell
Dim strWallpaper
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
strWallpaper = WshShell.RegRead(&quot;HKCU\ControlPanel\Desktop\Wallpaper&quot;)
Wscript.Echo strWallpaper
</Script>

I get an error that an object is required. Can anyone tell me why or give me a foolproof way to read a registry key?

I am wanting to read <Reg_SZ> value from the HKCR that is assigned to the .mde key. Any help would be more than greatly appreciated.
 
Quick and easy method using what you have already

Code:
Dim KeyName,strMDEValue
Set WshShell = CreateObject(&quot;WScript.Shell&quot;)
KeyName = &quot;HKEY_CLASSES_ROOT\.mde\&quot;
strMDEValue = WshShell.RegRead(KeyName)
Wscript.Echo MDEValue

Hope that helps
 
Thrall:

Thanks for the tip. It's doing exactly what I needed. I could have sworn that I had tried every combination of punctuation to get that, but obviously not. Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top