cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
joychen
Level 2

How to launch two process in the same time?

Hi,

I want to ask how to launch two processes(auctually 2 batch files) on the same time?
What's more, I have to check if both processes are finished.
How can I do that?

Thanks!
Labels (1)
0 Kudos
(1) Reply
tsnelson1
Level 3

You could consider launching your applications asynchronously (not waiting for completion), either through LaunchApplication, or CA Launch Application.

After they are launched, you could have a CA vbscript action to check through the processes until they both are finished (not found in process list).

i.e. Detecting if a process is still running...
Dim objWMIService, colProcessList
Dim iReturn
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name LIKE '' Or Name LIKE ''")
For Each objProcess in colProcessList
InfoMessage "Process '" & objProcess.Name & "' is still running"
Next

InfoMessage is a logging function I call to log information, you would need to add logic to keep looping to wait until completion, but that could get you a little further.

joychen wrote:
Hi,

I want to ask how to launch two processes(auctually 2 batch files) on the same time?
What's more, I have to check if both processes are finished.
How can I do that?

Thanks!
0 Kudos