Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] User Tips, Tricks and Samples
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Rating: Thread Rating: 9 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #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
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 05:40 AM.


Copyright © 1999-2023 Kinook Software, Inc.