'要用到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