标题: [已解决]我想用VBS判断一个注册的键值存不存在 
[打印本页]
作者: hackhd     
时间: 2008-1-27 00:50    
标题: [已解决]我想用VBS判断一个注册的键值存不存在
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer\Run\" 
   """mingzi""=""1.exe""" 
假如我想在VBS里面判断这个键值为mingzi存不存在。内容为1.exe存不存在。怎么做?
 Last edited by hackhd on 2008-1-28 at 02:27 AM ]
作者: hackhd     
时间: 2008-1-27 19:09
给点提示啊。
作者: slore     
时间: 2008-1-27 20:49
你会写不会查?query什么的好像……
作者: hackhd     
时间: 2008-1-27 21:26
如果这个路径存在。我可以判断到值
Dim WshShell,keys
Set WshShell = WScript.CreateObject("WScript.Shell")
keys=wshshell.regread ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\Explorer")
if keys<>"qq.exe"  then
msgbox("呀呀,没有写进去啊")
end if
 
那要是路径不存在就会出错。就要加一个判断路径是否存在的语句。。
怎做呢?
 Last edited by hackhd on 2008-1-27 at 11:34 PM ]
作者: slore     
时间: 2008-1-28 01:11
就是错了就不存在啊
on Error Resume Next
Dim WshShell,keys
Set WshShell = WScript.CreateObject("WScript.Shell")
keys = wshshell.regread ("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run\Explorer")
If Err Then
    MsgBox Err.description
Else
    If keys <> "qq.exe"  Then
        MsgBox "呀呀,没有写进去啊"
    End If
End If
作者: hackhd     
时间: 2008-1-28 02:27
其实已经解决了我没有把标题修正。
我是加了一个容错代码