手机
当前位置:查字典教程网 >脚本专栏 >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列出注册表中 Run 项中的所有项目

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

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

vbs删除注册表项的代码

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

用vbs实现删除名称中有撇号的文件夹

用vbs实现取消隐藏文件夹中的所有文件

用vbs删除前一天创建的备份文件

用vbs将本地文件替换为在文件服务器上找到的新版本

精品推荐
分类导航