用vbs列出机器上所有能调用的组件

所属分类: 脚本专栏 / vbs 阅读数: 1883
收藏 0 赞 0 分享

'要用到regtool.ocx,请下载regtool.ocx,用前请

regsvr32 regtool.ocx 

核心代码

set wshshell = CreateObject("WScript.Shell") 
set registry = CreateObject("regtool.tob") 
'获取一个dictionary对象存储键名 
set dict = CreateObject("Scripting.Dictionary") 
'列举HKEY_CLASSES_ROOT中所有键 
set allkeys = registry.RegEnum("HKCR\") 
'排除所有键中键名有点的。 
for each key in allkeys 
'第1个点在哪儿(跳过初始点)? 
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) 
'写信息到记录文件 
output.WriteLine text 
end sub 
更多精彩内容其他人还在看

vbs整人代码大集合 多年的代码收集

vbs整人代码大集合,收集的比较全,喜欢的朋友可以参考下。不要搞破坏,学习vbs的朋友非常有帮助,死循环的使用比较多。
收藏 0 赞 0 分享

vbs sendKeys Virtual-Key Codes 十六进制符号

下表显示了十六进制符号常量名,,由系统所使用的虚拟键码和鼠标或键盘等值。这些代码数字顺序列出。
收藏 0 赞 0 分享

vbs sendKeys 16进制的结合使用(打开IE,静音,打开播放器等)

看到demon.tw的文章,发现的sendkeys 16进制的效果,非常的不错,喜欢的朋友可以参考下。
收藏 0 赞 0 分享

VBS 显示“选择文件或文件夹”对话框的代码

VBS 显示“选择文件或文件夹”对话框的代码,经测试windows xp下才可以使用,win2000,win2003没有内置这样的方法。
收藏 0 赞 0 分享

VBS加密解密源码(UserAccounts.CommonDialog) 脚本之家修正版

有时候自己写了VBS又怕共享后别人盗用你的源码呢?这里提供了VBS程序源码加密的方法。
收藏 0 赞 0 分享

实现winrar密码破解的vbs代码

用vbs实现的用了破解winrar密码的代码,需要的朋友可以参考下。
收藏 0 赞 0 分享

VBS 两数相加取值问题分析

vbs中通过intpu传值进行运算的方法,需要的朋友可以参考下。
收藏 0 赞 0 分享

VBS获取重定向的URL的代码

我本来想获取aaa.com页面的内容,可是aaa.com跳转到bbb.com了。我想获取bbb.com 这个网址。
收藏 0 赞 0 分享

VBS中InputBox函数的返回值使用技巧

你一定很熟悉InputBox函数,就像熟悉MsgBox函数一样。一般来说,刚开始接触VBS的时候,学会的第一个函数是MsgBox,而第二个就是InputBox。
收藏 0 赞 0 分享

用VBS精确计算100的阶乘的实现代码

运行一下上面的程序,输出2.43290200817664E+18。笑而不语,再次证明了我之前的结论,在这种网站上回答问题的,大部分水平都不咋地。
收藏 0 赞 0 分享
查看更多