手机
当前位置:查字典教程网 >脚本专栏 >vbs >用vbs列出机器上所有能调用的组件
用vbs列出机器上所有能调用的组件
摘要:'要用到regtool.ocx,请下载http://www.jb51.net/jslib/regtool.ocx,用前请regsvr32re...

'要用到regtool.ocx,请下载http://www.jb51.net/jslib/regtool.ocx,用前请regsvr32regtool.ocx

setwshshell=CreateObject("WScript.Shell")

setregistry=CreateObject("regtool.tob")

'获取一个dictionary对象存储键名

setdict=CreateObject("Scripting.Dictionary")

'列举HKEY_CLASSES_ROOT中所有键

setallkeys=registry.RegEnum("HKCR")

'排除所有键中键名有点的。

foreachkeyinallkeys

'第1个点在哪儿(跳过初始点)?

pos=Instr(2,key,".")

ifpos>0then

'there'sadot.Isthereanotherone?

pos2=Instr(pos+1,key,".")

ifpos2>0then

'yes,sothisnameisversionspecific

'checkwhetherwealreadyhavea

'version-independentprogid!

independent=left(key,pos2-1)

ifnotdict.Exists(independent)then

'no,storeit

dict.Addkey,0

endif

else

'thisoneisversion-independent.

'dowealreadyhaveaversion-dependent

'progIDinstore?

vdpid=""

foreachelementindict

iflen(element)>len(key)then

ifleft(element,len(key)+1)=key&"."then

'yes,returnname

vdpid=element

exitfor

endif

endif

next

'anyversiondependentprogIDfound?

ifvdpid=""then

'no,addtostore

dict.addkey,0

else

'yes,replace

dict.Removevdpid

dict.addkey,0

endif

endif

endif

next

MsgBoxdict.Count&"Objectsfound!"

foreachkeyindict

list=list&key&vbCrlf

next

MsgBoxlist

outputfile="C:OBJECT.TXT"

setfs=CreateObject("Scripting.FileSystemObject")

setoutput=fs.CreateTextFile(outputfile,true)

printdict.Count&"Objectsfound!"

Printlist

output.close

wshshell.runoutputfile

subPrint(text)

'写信息到记录文件

output.WriteLinetext

endsub

【用vbs列出机器上所有能调用的组件】相关文章:

vbscript 三个数比较大小的实现代码

用vbs实现更改计算机的说明的代码

用vbscript合并多个文本文件的代码

用vbs确定用户的登录名的代码

用vbs实现本地添加用户的脚本

用vbs列出注册表中 Run 项中的所有项目

vbs输入助手执行会调用好多乱的进程

用vbs实现防止计算机使用 LMHosts 文件

用vbs确定计算机是否有 USB 2.0 端口的代码

用vbs实现zip功能的脚本

精品推荐
分类导航