Use VBS to list all components that can be invoked on the machine _vbs

Source: Internet
Author: User
Tags allkeys
' To use the regtool.ocx, please download http://www.jb51.net/jslib/regtool.ocx, please regsvr32 regtool.ocx before use

Set WshShell = CreateObject ("Wscript.Shell")
Set registry = CreateObject ("Regtool.tob")
' Get a Dictionary object to store the key name
Set dict = CreateObject ("Scripting.Dictionary")
' Enumerate all the keys in HKEY_CLASSES_ROOT
Set AllKeys = registry. Regenum ("Hkcr\")
' Excludes all keys with a bit of the key name.
For each key in AllKeys
' Where is the 1th point (skip the initial point)?
pos = INSTR (2, Key, ".")
If Pos>0 Then
' There ' s a dot. Is there another one?
Pos2 = Instr (pos+1, Key, ".")
If Pos2>0 Then
' Yes ', so this name is version specific
' Check whether we already have a
' Version-independent progid!
Independent = Left (key, pos2-1)
If not dict. Exists (Independent) Then
' No, store it
Dict. Add Key, 0
End If
Else
' This is version-independent.
' Do we already have a version-dependent
' ProgID in store?
Vdpid = ""
For each element in Dict
If Len (Element) >len (key) Then
If left (element, Len (key) +1) =key & "." Then
' Yes, return name
Vdpid = Element
Exit For
End If
End If
Next
' Any version dependent ProgID found?
If vdpid= "" Then
' No, add to store
Dict.add Key, 0
Else
' Yes, replace
Dict. Remove Vdpid
Dict.add Key, 0
End If
End If
End If
Next
MsgBox Dict. Count & "Objects found!"
For each key in Dict
List = list & key & VbCrlf
Next
MsgBox List
outputfile = "C:\OBJECT." TXT "
Set fs = CreateObject ("Scripting.FileSystemObject")
Set output = fs. CreateTextFile (OutputFile, True)
Print Dict. Count & "Objects found!"
Print List
Output.close
Wshshell.run outputfile
Sub Print (text)
' Write the information to the record file
Output. WriteLine text
End Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.