View Single Post
  #5  
Old 04-03-2019, 04:40 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
It's not really a Visual Build question. Paste the following into a text file.

Code:
Function FindProcesses(computer, processName)

	Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\cimv2")

	sql = "SELECT * FROM Win32_Process WHERE Name LIKE '" & processName & "'"
	Set colProcesses = objWMIService.ExecQuery(sql)

	If colProcesses.Count = 0 Then
		FindProcess = "0"
	Else
		For Each objProcess in colProcesses
    		FindProcesses = FindProcesses & vbCrLf & objProcess.ProcessID
		Next
	End If
	
End Function

WScript.Echo(FindProcesses("COMPUTER", "builddoc.exe"))
Save as wait.vbs.

Open a Command Prompt to the path where you saved the .vbs file and run

cscript wait.vbs

I did this with cmd.exe instead of builddoc.exe and got a list of process IDs for each running cmd.exe instance.
Reply With Quote