|
|
发表于 2012-6-6 10:27:55
|
显示全部楼层
回复 18# wh1234567
为了便于显示,作了少许修改,但不影响原有功能。
C:\Users\root\Desktop>type a.bat
@echo hello&pause
C:\Users\root\Desktop>type a.vbs
...
Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
Value = ws.RegRead(Hive&"\"&KeyPath&"\"&ValueName)
WScript.Echo "Registry Value Changed: " & Value
if CStr(Value)="29" then ws.Run "a.bat" ',0 '后面加0表示隐藏窗口运行
End Sub
C:\Users\root\Desktop>start /b cscript C:\Users\root\Desktop\a.vbs
Listening for Registry Change Events...
C:\Users\root\Desktop>reg add hklm\Software\333 /v 444 /d 28 /f
操作成功完成。
Registry Value Changed: 28
C:\Users\root\Desktop>reg add hklm\Software\333 /v 444 /d 29 /f
操作成功完成。
Registry Value Changed: 29
C:\Users\root\Desktop>
vbs运行a.bat弹出了一个窗口:
hello
请按任意键继续. . . |
|