Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Check if a Registry key exists

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,60447
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Check if a Registry key exists
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Check if a Registry key exists - 5/19/2008 11:31:41 PM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
With a little help from ehvbs and dm_4ever, i concocted the following, really easy to use, RegKeyExists function


      

Syntax:
If RegKeyExists ("HIVE", "PATH", "KEY") Then
 
 
Post #: 1
 
 RE: Check if a Registry key exists - 5/21/2008 4:38:43 AM   
  Fredledingue


Posts: 367
Score: 0
Joined: 5/9/2005
From:
Status: offline
Maybe not as elegant but i put it here anway:


      

_____________________________

Fred

(in reply to GreatBarrier86)
 
 
Post #: 2
 
 RE: Check if a Registry key exists - 5/26/2008 12:36:36 PM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
That was my original thought, but if you do that, then you have to put in "On Error Resume Next" and i'm not a fan of that, unless i absolutely have to use it.

(in reply to Fredledingue)
 
 
Post #: 3
 
 RE: Check if a Registry key exists - 5/27/2008 3:56:54 AM   
  DiGiTAL.SkReAM


Posts: 1170
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
I feel the same way about WMI, and personally I use much the same process as Fredledingue.


      



< Message edited by DiGiTAL.SkReAM -- 5/27/2008 3:58:59 AM >


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to GreatBarrier86)
 
 
Revisions: 1 | Post #: 4
 
 RE: Check if a Registry key exists - 5/27/2008 5:49:02 AM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
 lol...so u like both of our methods?

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 5
 
 RE: Check if a Registry key exists - 5/27/2008 6:17:59 AM   
  DiGiTAL.SkReAM


Posts: 1170
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
What I meant was that I feel about WMI like you do about On Error Resume Next.
I don't like it, and use it only when there is no other recourse.


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to GreatBarrier86)
 
 
Post #: 6
 
 RE: Check if a Registry key exists - 5/27/2008 7:21:38 AM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
But other than that, u like OERN?

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 7
 
 RE: Check if a Registry key exists - 5/27/2008 5:00:21 PM   
  DiGiTAL.SkReAM


Posts: 1170
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
It isn't something that I spend time in the morning planning ways to utilize during my work day, but if the need for it arises, i see no problems with it.
And as limited as the error handling is in vbs, it comes in handy.


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to GreatBarrier86)
 
 
Post #: 8
 
 RE: Check if a Registry key exists - 5/31/2008 10:25:47 PM   
  Fredledingue


Posts: 367
Score: 0
Joined: 5/9/2005
From:
Status: offline
I'm not a fan of it neither. The goal is to put as little code as possible between on error resume next and on error goto 0 so you stil can debug your script.

_____________________________

Fred

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 9
 
 RE: Check if a Registry key exists - 6/11/2008 9:11:24 AM   
  GreatBarrier86

 

Posts: 71
Score: 0
Joined: 3/10/2008
Status: offline
Well. i am quite proud of it :)

By the way fred, does On Error Goto 0 mean to turn off OERN?

(in reply to Fredledingue)
 
 
Post #: 10
 
 RE: Check if a Registry key exists - 6/11/2008 6:04:07 PM   
  DiGiTAL.SkReAM


Posts: 1170
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
Yes.

      


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to GreatBarrier86)
 
 
Post #: 11
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Check if a Registry key exists Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts