On error resume next

Err.clear

WshShell.RegRead

If err then

                .key doesn't exist

                Wscript.quit

End If

On error goto 0

 

.key exists

 

Regards,

 

Michael B. Smith, MCITP:SA,EMA/MCSE/Exchange MVP

My blog: http://TheEssentialExchange.com/blogs/michael

Link with me at: http://www.linkedin.com/in/theessentialexchange

 

From: Sam Cayze [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 22, 2008 12:31 PM
To: NT System Admin Issues
Subject: Script Question/Does regvalue exist?

 

Running a script that pulls a regkey from the registry using
WshShell.RegRead.

 

Works fine if the regkey exists, but if it doesn't, Windows Script Host
tosses an on-screen error.  

 

Any way to do this?:

 

IF Key exists...

    WshShell.RegRead

else

    Quit

 

 

Thanks!

 

 

 

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to