Use vbs to list all the components that can be called on the machine

Source: Internet
Author: User
Tags allkeys

'To use regtool. ocx, download http://www.jb51.net/jslib/regtool.ocx. before using regsvr32 regtool. ocx

Set wshshell = Createobject ("wscript. Shell ")
Set registry = Createobject ("regtool. TOB ")
'Get a dictionary object storage key name
Set dict = Createobject ("scripting. Dictionary ")
'Enumerate all keys in hkey_classes_root.
Set allkeys = registry. regenum ("hkcr \")
'Exclude all key and key names.
For each key in allkeys
'Where are the 1st points (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
'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 one 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
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 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.