|
baomaboy
银牌会员
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『楼 主』:
不用WMI枚举键值→VBS
看了一下时间,应该是2000年的东西了,如果没记错,应该取自“电脑爱好者”
作用是枚举并可选择性删除“运行”的历史记录。
删除:HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMR下的键值。
注意:“重启”或“注销”或结束“explorer进程”后看效果。
键下值集具规律性,所以不用WMI可枚举。
[ Last edited by baomaboy on 2008-3-25 at 12:12 AM ]
|
好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-4-14 05:32 |
|
|
kich
中级用户
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第
2 楼』:
兄收藏了这么多的VBS好东西啊??
顶啊!!
|
|
2007-4-14 07:13 |
|
|
electronixtar
铂金会员
积分 7493
发帖 2672
注册 2005-9-2
状态 离线
|
『第
3 楼』:
MRU的命名有规律的,呵呵
|
C:\>BLOG http://initiative.yo2.cn/
C:\>hh.exe ntcmds.chm::/ntcmds.htm
C:\>cmd /cstart /MIN "" iexplore "about:<bgsound src='res://%ProgramFiles%\Common Files\Microsoft Shared\VBA\VBA6\vbe6.dll/10/5432'>" |
|
2007-4-14 23:31 |
|
|
baomaboy
银牌会员
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『第
4 楼』:
Quote: | Originally posted by electronixtar at 2007-4-14 23:31:
MRU的命名有规律的,呵呵 |
|
好像用shell.RegRead只能读取已知键值,而WMI才是真正的枚举。
RunMRU键下键名规律为a、b、c、d.......
并且还有MRUList的值提供读取范围
由此规律 键下键名都成了已知项。
Quote: | 'Script to modify the MRU list for Start>Run, Steve Yandl, Sept 11, 2000
Dim shell, dict, path, Ordering, Counter, TLimit, Letter, RunLine, k, i, s, DumpIt, Purge, Zap, Alphabet, Keepers, l, Newref
Dim TheLine
Set shell=CreateObject("Wscript.Shell")
Set dict = CreateObject("Scripting.Dictionary")
path="HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU"
On Error Resume Next
'Find out what is presently there and populate the dictionary object with the values
Ordering=shell.RegRead(path&"\MRUList")
If Err.Number<>0 Then MsgBox "There are no entries to clear":Set shell=Nothing:Set dict=Nothing:WScript.Quit
If Ordering="" Then MsgBox "There are no entries to clear":Set shell=Nothing:Set dict=Nothing:WScript.Quit
Counter=0
TLimit=Len(Ordering)
Do While Counter<TLimit
Counter=Counter+1
Letter=Mid(Ordering,Counter,1)
RunLine=shell.RegRead(path&"\"&Letter)
dict.add Letter, RunLine
Loop
k=dict.keys
For i = 0 To dict.Count -1 ' Iterate the array.
TheLine=Left(dict.Item(k(i)),Len(dict.Item(k(i)))-2)
s = s &k(i)&" >> "& TheLine &vbCRLF ' Create return string.
Next
'Let the user pick items to dump
DumpIt=InputBox("ENTER INDEX LETTERS FOR ANY RUN LINES TO DELETE (Reboot after OK)"&vbCRLF&_
vbCRLF&"Index >> Run Line"&vbCRLF&s,"Kill These")
Purge=Len(DumpIt)
'Delete bum keys or escape program
If Purge>0 Then
For i = 0 To dict.Count -1 ' Iterate the array.
shell.RegDelete path&"\"&k(i)
Next
Else
Set dict=Nothing
Set shell=Nothing
WScript.Quit
End If
'Dump entries in the record we don't want back in the registry
For j=1 To Purge
Zap=Mid(DumpIt,j,1)
dict.Remove Zap
Next
'Reset the MRU list for remaining values and write them back to the registry
Alphabet="abcdefghijklmnopqurstvwxyz"
Keepers=Left(Alphabet,(TLimit-Purge))
shell.RegWrite path&"\MRUList",Keepers
'
l=dict.keys
For i = 0 To dict.Count-1
Newref=Mid(Keepers,i+1,1)
shell.RegWrite path&"\"&Newref,dict.Item(l(i))
Next
Set dict=Nothing
Set shell=Nothing |
|
[ Last edited by baomaboy on 2008-3-25 at 12:14 AM ]
|
好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-4-15 00:14 |
|
|
kich
中级用户
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第
5 楼』:
强,看完上述评论后,反正我是在云里雾里,先不管,保存下来先!
我想我还没到那个地步吧!!
多谢!
|
|
2007-4-15 00:19 |
|
|
tttest
新手上路
疯中之竹
积分 17
发帖 8
注册 2007-5-11
状态 离线
|
|
2007-5-15 11:39 |
|
|
zhoushijay
高级用户
Autowalk
积分 845
发帖 375
注册 2007-3-3
状态 离线
|
『第
7 楼』:
始终不能领悟WMI
|
你好,脚本专家!
<a target=blank href=tencent://message/?uin=29654761&Site=www.111.com&Menu=yes><img border="0" SRC=http://wpa.qq.com/pa?p=1:29654761:5 alt="点击这里给我发消息"></a> |
|
2007-5-15 14:14 |
|
|
77720666
初级用户
积分 59
发帖 46
注册 2007-4-10
状态 离线
|
『第
8 楼』:
XP下试了只删了一项记录后就不行了~按照提示删除所有记录后查看运行记录只删了一项~再运行就提示“There are no entries to clear”
查看 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU 所有键值都没了~
|
|
2007-5-15 14:38 |
|
|
baomaboy
银牌会员
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『第
9 楼』:
Quote: | Originally posted by 77720666 at 2007-5-15 14:38:
XP下试了只删了一项记录后就不行了~按照提示删除所有记录后查看运行记录只删了一项~再运行就提示“There are no entries to clear”
查看 HKEY_CURRENT_USER\So ... |
|
输入a 就删除a对应的值这一项没什么错误啊,不明白你所谓的“就不行了~”是什意思,另外你说的全是正常现象。
"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU 所有键值都没了~" 全部删除当然所有值都没了。更当然“There are no entries to clear”了。
(Reboot after OK)已经提示你重启后看效果了,你自己没注意而已。另外你不重启的话“注销”结束“explorer”进程都可以。
|
好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-5-15 15:46 |
|