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

所属分类: 脚本专栏 / vbs 阅读数: 1807
收藏 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实现恢复暂停的自动启动服务的脚本

有时候我们需要把自启动的服务停掉,方便我们处理事务,但我们如果一次停掉的自启动服务比较多,如何一次性启动他们呢
收藏 0 赞 0 分享

vbs删除注册表项的代码

一般我们删除注册表时这个是另外一个方法,这个是结合系统
收藏 0 赞 0 分享

用vbs检查注册表项的访问权限的代码

有时候我们需要知道我们是否对注册表有访问权限,下面的代码就是解决了这个问题,检查下是否能用vbs修改注册表项
收藏 0 赞 0 分享

vbs之使用Internet Explorer 屏蔽密码

演示如何通过脚本创建 Internet Explorer 的实例,并检索输入密码样式的文本框中的密码。需要带有适当的文本框的 Web 页(名为 password.htm)。
收藏 0 赞 0 分享

vbscript 注册表脚本书写

用vbscript实现的修改注册表的脚本,建议大家看看
收藏 0 赞 0 分享

vbs下通过日期查找文件夹的代码

用vbscript根据日期查找文件,有时候我们需要找指定日期的文件,用下面的代码即可
收藏 0 赞 0 分享

vbs复制文件的脚本

用vbscript实现文件的复制功能,主要用于一般的备份等操作
收藏 0 赞 0 分享

vbs实现计算机重启

用vbscript实现系统的重启,其实就是用vbscript执行系统下的shutdown.exe实现,汗
收藏 0 赞 0 分享

文件备份vbs脚本

vbs实现文件的备份,默认覆盖操作
收藏 0 赞 0 分享

vbs下用一个小方法实现批量添加域用户

在域模式下批量添加域用户就有些困难,下面是一个vbs脚本,在同级目录下用放置一个users.txt的文本文档,格式:username,password,在dc上运行该脚本,即可以将users.txt的用户信息批量添加到ad里面。可以通过移动或拖拽的方法,将生成的用户移动到ou下面
收藏 0 赞 0 分享
查看更多