Wait till Cmd execution stops


#1

Is there any way to wait until cmd execution stops? Right now workflow execution stops but cmd still runs in the background. Please kindly share the solution.
Thanks


#2

One option is the cmd execution should indicate the completion by some mechanism ie create a file, update some flag, send a mail etc… in the workflow use dowhile loop to check the completion.


#3

You could use the get process activity to determine if cmd execution is still running or not and use this as the trigger when it stops perhaps?


#4

It is a bit tricky but you can copy the output of your command into your clipboard with “|clip” and compare the string that cmd returns to you. Only works when the command returns something and when you start the command yourself of course.

Does work like this:

  1. In Studio: Set the clipboard to a default Value with the “Set to Clipboard”-Activity (Something like: “Not Finished”)
  2. In Cmd window: command |clip
  3. In Studio: Use “Get From Clipboard”-Activity in a while loop to set it to a String variable
  4. Compare the String in the Condition of the while loop. (Like: not clipboardVar.Equals(“Not Finished”))

So as long as the the value in the variable of the clipboard is the default value that you set in step 1 the command is not finished. If you do it like this you should consider using a limit of comparisons(Compare a counter of the Tryouts as well) because if something goes wrong your process will stay in the while loop forever.

Hope this helps.

Regards
Bob


#5

Seems easy solution, I will try this.
Thanks


#6

Thanks Everyone :slight_smile: