|
- Set WshShell = WScript.CreateObject("WScript.Shell")
- Do
- Set objSvc = Getobject("winmgmts:\\.")
- Set objProcess = objSvc.InstancesOf("Win32_Process")
- For Each strProcess In objProcess
- Name = strProcess.Name
- If LCase(Name) = LCase("NotePad.exe") Then Flag = "1"
- Next
- If Flag = "1" Then
- Flag = ""
- Else
- WshShell.Run "MsPaint.exe" : WScript.Quit
- End If
- WScript.Sleep 1000
- Loop
复制代码
保存为vbs,请更改文件名和路径为实际。
如果进程中有记事本,就不打开画图,等等待记事本结束再打开。。。
如果进程中没有记事本,直接打开画图。 |
|