用vbs列出機器上所有能調(diào)用的組件
'要用到regtool.ocx,請下載//www.jb51.net/jslib/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實現(xiàn)的eMule電驢自動關機腳本代碼
欄 目:vb
下一篇:高手必看的vbs的至尊境界
本文地址:http://mengdiqiu.com.cn/a1/vb/7652.html
您可能感興趣的文章
- 01-10下載文件到本地運行的vbs
- 01-10VBS中的正則表達式的用法大全 <font color=red>原創(chuàng)&
- 01-10VBS中SendKeys的基本應用
- 01-10VBScript教程 第十一課深入VBScript
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript語法速查及實例說明
- 01-10VBS中Select CASE的其它用法
- 01-10VBScript教程 第七課使用條件語句
- 01-10vbscript 可以按引用傳遞參數(shù)嗎?
- 01-10VBScript教程 第二課在HTML頁面中添加VBscript代碼


閱讀排行
本欄相關
- 01-10下載文件到本地運行的vbs
- 01-10飄葉千夫指源代碼,又稱qq刷屏器
- 01-10SendKeys參考文檔
- 01-10什么是一個高效的軟件
- 01-10VBS中的正則表達式的用法大全 &l
- 01-10exe2swf 工具(Adodb.Stream版)
- 01-10VBS中SendKeys的基本應用
- 01-10用VBSCRIPT控制ONSUBMIT事件
- 01-10VBScript教程 第十一課深入VBScript
- 01-10VBScript語法速查及實例說明
隨機閱讀
- 01-10使用C語言求解撲克牌的順子及n個骰子
- 08-05dedecms(織夢)副欄目數(shù)量限制代碼修改
- 01-10delphi制作wav文件的方法
- 01-10SublimeText編譯C開發(fā)環(huán)境設置
- 01-11Mac OSX 打開原生自帶讀寫NTFS功能(圖文
- 04-02jquery與jsp,用jquery
- 08-05織夢dedecms什么時候用欄目交叉功能?
- 08-05DEDE織夢data目錄下的sessions文件夾有什
- 01-10C#中split用法實例總結
- 01-11ajax實現(xiàn)頁面的局部加載