|
|
发表于 2012-6-4 16:24:07
|
显示全部楼层
回复 8# wh1234567
vbs- Hive = "HKEY_LOCAL_MACHINE"
- KeyPath = "Software\333"
- ValueName = "444"
- Set ws = CreateObject("WScript.Shell")
- Set Sink = WScript.CreateObject("WbemScripting.SWbemSink", "SINK_")
- Set objWMIServices = GetObject("winmgmts:" & _
- "{impersonationLevel=impersonate}!\\.\root\default")
- objWMIServices.ExecNotificationQueryAsync Sink, _
- "Select * from RegistryValueChangeEvent Where " & _
- "Hive = '"&Hive&"' and " & _
- "KeyPath = '"&Replace(KeyPath,"","\")&"' and " & _
- "ValueName = '"&ValueName&"'"
- WScript.Echo "Listening for Registry Change Events..." & vbCrLf
- Do : WScript.Sleep 1000 : Loop
- Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
- Value = ws.RegRead(Hive&""&KeyPath&""&ValueName)
- 'WScript.Echo Value
- if CStr(Value)="29" then ws.Run "a.bat",0
- End Sub
复制代码 |
评分
-
查看全部评分
|