手机
当前位置:查字典教程网 >脚本专栏 >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列出机器上所有能调用的组件】相关文章:

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

vbs xmldom初次实战获取QQ签名的代码

用vbs实现的强制杀进程的脚本

用VBS检测U盘插入与弹出事件的代码

用vbs实现对文本文件中的项计数

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

使用vbscript脚本在表单中进行选择的代码

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

vbs删除注册表项的代码

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

精品推荐
分类导航