Hello, I need to add to my script to kill a process tree at the end. Could anyone please provide an example of how I can do this. You're help is much appreciated.
Thank you for the help,
Answer by Ravi S. ·
You can use the call to the function
where myprocess is the process you want to kill. For more information you can go to the following link:
Thanks & Regards
Answer by Medgar M. ·
In the task manager the name of the process is often controlled by the app or executable. If you can identify the executable (or app) you may use the “KillApp” fuction in junction with the specific app you desired to be terminated. For example to kill Chrome I would put KillApp (“Chrome.exe”) in my script to make sure chrome is no longer running.
The KillApp function is an action of the framework that is in place to make your scripting experience more pleasant. Please refer to these modules to see if they can help enhance your scripts.
Answer by Yuriy L. ·
You can use Shell command to start a command-line utility taskkill. /t parameter would allow to terminate a tree. If you need to rely on termination of all processes in the tree in the subsequent lines, put some delay after the Shell command to allow taskkill to finish. Probably Sleep 500, tpMilliseconds would be sufficient.
Also if all processes in the tree have the same name, like in case if Internet Explorer and Chrome, KillApp, suggested in the previous answers would work too. But I would recommend to use a loop with IsRunning function, because these browsers have a resiliency features that would start a replacement process from the one that is still running. Doing KillAppp in the loop would reilably terminate the whole process tree of these browsers.