Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "how to use vbs to list all the components that can be called on the machine", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to use vbs to list all the components that can be called on the machine.

Core code

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 names in the keys. Where is the first point of for each key in allkeys'(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 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 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 information to the record file output.WriteLine text end sub here, I believe you have a better understanding of "how to use vbs to list all the components that can be called on the machine", you might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report