Option Explicit
Dim objWMIService, objProcess, colProcess, strComputer, processName, instances
strComputer = "."
instances = 0
processName = "wscript.exe"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process")
For Each objProcess in colProcess
If objProcess.Name = processName Then instances = instances + 1
Next
If processName = "wscript.exe" Then
If instances = 1 Then
WScript.Echo "There is no other VBScript running except this one!"
Else
WScript.Echo "There are currently " & "(" & instances & ") " & "VBScript" & " Instances running!"
End If
Else
WScript.Echo "There are currently " & "(" & instances & ") " & """" & processName & """" & " Instances running!"
End If
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
亖呉?盀