# How to use Kill Process

**URL:** <https://forum.uipath.com/t/how-to-use-kill-process/5743>\
**Category:** Help\
**Tags:** studio, system, activities\
**Created:** [June 2, 2017, 5:57pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743 "2017-06-02T17:57:13Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kusum\_R](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@Kusum\_R](https://forum.uipath.com/u/Kusum_R)\
**Post date:** [June 2, 2017, 5:57pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/1 "2017-06-02T17:57:13Z")

</div>

I am trying to close application after finishing the process.However am not clear of what values to populate in the Target Section for Process and Process Name.Can anyone give me a sample example please?

---

<div class="post-metadata">

**Author:** ![selrac](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/selrac/32/468_2.png) [@selrac](https://forum.uipath.com/u/selrac)\
**Post date:** [June 2, 2017, 6:44pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/2 "2017-06-02T18:44:03Z")

</div>

This works for me:

![](https://global.discourse-cdn.com/uipath/original/2X/4/4601deb67d3976231f48a3cfe447f0037e5d3c6f.png)

---

<div class="post-metadata">

**Author:** ![Kusum\_R](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@Kusum\_R](https://forum.uipath.com/u/Kusum_R)\
**Post date:** [June 2, 2017, 8:24pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/3 "2017-06-02T20:24:22Z")

</div>

Sorry i dint quite understand this solution.Could you please elaborate? .

---

<div class="post-metadata">

**Author:** ![vvaidya](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@vvaidya](https://forum.uipath.com/u/vvaidya)\
**Post date:** [June 2, 2017, 9:59pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/4 "2017-06-02T21:59:23Z")

</div>

You have to pass either Process or ProcessName.

For Instance if you have to Close outlook

1. Use **GetProcesses** (collection) and loop it untill you get your Proccesses and kill them (multiple) using Kill Process

![](https://global.discourse-cdn.com/uipath/original/2X/5/55aeead3876abb8df1c6dc36ec2f0381499de4db.png)

1. Kill one process use Kill Process Activity and pass one of below  
process = System.Diagnostics.Process.GetProcessesByName(“OUTLOOK”) —\> process  
“OUTLOOK” —\> processname

---

<div class="post-metadata">

**Author:** ![selrac](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/selrac/32/468_2.png) [@selrac](https://forum.uipath.com/u/selrac)\
**Post date:** [June 3, 2017, 6:50am UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/5 "2017-06-03T06:50:44Z")

</div>

> [@Kusum\_R](#):
>
> you please elaborate

Kusum,

What I do to kill multiple applications is to call a bat file to close all of them at the same time. The bat file contains a list of taskkill commands as follows

taskkill /f /t /im iexplore.exe  
taskkill /f /im excel.exe

I find this usefull as it avoids having to handle error messages like, ‘do you want to close all tabs’ in IE

Hope this helps

---

<div class="post-metadata">

**Author:** ![Kusum\_R](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@Kusum\_R](https://forum.uipath.com/u/Kusum_R)\
**Post date:** [June 7, 2017, 2:21pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/6 "2017-06-07T14:21:12Z")

</div>

> [@vvaidya](#):
>
> System.Diagnostics.Process.GetProcessesByName(“OUTLOOK”)

Thanks that helped!

---

<div class="post-metadata">

**Author:** ![hellitonwoo](https://avatars.discourse-cdn.com/v4/letter/h/50afbb/32.png) [@hellitonwoo](https://forum.uipath.com/u/hellitonwoo)\
**Post date:** [September 15, 2017, 9:42pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/8 "2017-09-15T21:42:01Z")

</div>

Hi vvaidya,

First of all, thanks for providing the example!

I’m trying to use this “Kill process” to terminate “Chrome” browser processes.

So for those 2 criteria: Process and ProcessName, I can’t quite figure out how to deal with them.

What I’ve tried is, in “Process”, I wrote:  
program = system.Diagnostics.Process.GetProcessesByName(“_chrome_”)

 ![image](https://global.discourse-cdn.com/uipath/original/2X/4/4ca73fbfb6601ba6864b29408c02e7ab0d7c1673.png)

But I got the error:  
 ![image](https://global.discourse-cdn.com/uipath/original/2X/7/7eef842e3271c887cd3a2860409aeb320b130e27.png)

Could you help elaborate what did I do wrong?

And also, I don’t quite understand the point of using “ProcessName”.

Here are some samples of the processes (I did a loop on them and used process.tostring sort of thing to see the results)  
System.Diagnostics.Process (svchost)  
System.Diagnostics.Process (svchost)  
System.Diagnostics.Process (igfxext)  
System.Diagnostics.Process (smss)  
System.Diagnostics.Process (chrome)  
System.Diagnostics.Process (svchost)  
System.Diagnostics.Process (svchost)  
System.Diagnostics.Process (WmiPrvSE)  
System.Diagnostics.Process (taskhostw)  
System.Diagnostics.Process (explorer)  
System.Diagnostics.Process (svchost)  
System.Diagnostics.Process (iPodService)  
System.Diagnostics.Process (cmd)

Does it mean the “svchost”, “explorer” are “ProcessName”?  
I did try putting “_chrome_” in the ProcessName field, but it doesn’t work.

Thanks a lot for the help!

BR  
Hao

---

<div class="post-metadata">

**Author:** ![ovi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ovi/32/21072_2.png) [@ovi](https://forum.uipath.com/u/ovi)\
**Post date:** [September 15, 2017, 10:10pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/9 "2017-09-15T22:10:48Z")

</div>

Hi @hellitonwoo

Process is the process type object to be selected to kill. As you can see in the error message, it is recommended to use “Is” instead of “=”, but this would retrieve a boolean value that would not be compatible to the System.Diagnostics.Process type.  
So you could just write **System.Diagnostics.Process.GetProcessesByName(“chrome”)(0)** – it will kill the first chrome process in the AllProcesses list.  
Or a much simple solution would be to give directly the **ProcessName** as string: just type **“chrome”**.

> [@hellitonwoo](#):
>
> Does it mean the “svchost”, “explorer” are “ProcessName”?

Yes, those are the Process names.

---

<div class="post-metadata">

**Author:** ![vvaidya](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@vvaidya](https://forum.uipath.com/u/vvaidya)\
**Post date:** [September 15, 2017, 10:11pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/10 "2017-09-15T22:11:13Z")

</div>

I guess you have to keep if condition in for each

If Program.ProgramName =“chrome”

In kill activity just pass Program

---

<div class="post-metadata">

**Author:** ![vvaidya](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@vvaidya](https://forum.uipath.com/u/vvaidya)\
**Post date:** [September 15, 2017, 10:12pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/11 "2017-09-15T22:12:38Z")

</div>

Sorry Process.ProcessName

---

<div class="post-metadata">

**Author:** ![Senthilkumar55](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/senthilkumar55/32/497170_2.png) [@Senthilkumar55](https://forum.uipath.com/u/Senthilkumar55)\
**Post date:** [November 13, 2017, 11:32am UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/12 "2017-11-13T11:32:19Z")

</div>

Hi vvaidya,

I’m using **If else** activity inside for each activity. If my else block executed means. i don’t want to iterate **for each** loop again.But i want to skip the for each loop. So, could you help me to come to come out of this.

---

<div class="post-metadata">

**Author:** ![pravin.patil](https://avatars.discourse-cdn.com/v4/letter/p/90ced4/32.png) [@pravin.patil](https://forum.uipath.com/u/pravin.patil)\
**Post date:** [March 9, 2018, 12:07pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/13 "2018-03-09T12:07:16Z")

</div>

Don’t make it complicated. Just use process names you are using in process.  
Example: Suppose you are using EXCEL and OUTLOOK, please use the code given below.

To kill Excel drag Kill Process Activity and pass Process name property as EXCEL

To kill Outlook drag Kill Process Activity and pass Process name property as Outlook

Please find attached snap ![KillOutlook](https://global.discourse-cdn.com/uipath/original/2X/8/8226b4bd2598a4a82f9b0b8fa800d18a360c36b5.PNG)

---

<div class="post-metadata">

**Author:** ![ertogrul](https://avatars.discourse-cdn.com/v4/letter/e/779978/32.png) [@ertogrul](https://forum.uipath.com/u/ertogrul)\
**Post date:** [April 12, 2018, 2:54pm UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/14 "2018-04-12T14:54:30Z")

</div>

@pravin.patil, your recipe works and kills targeted processes. But it always ends with Aggregate Exception. Why is it so? Do you know how to avoid that?

 ![image](https://global.discourse-cdn.com/uipath/original/3X/b/b/bb6744a66704e2e675efed0f033ecf23e5ed247e.png)

---

<div class="post-metadata">

**Author:** ![pravin.patil](https://avatars.discourse-cdn.com/v4/letter/p/90ced4/32.png) [@pravin.patil](https://forum.uipath.com/u/pravin.patil)\
**Post date:** [June 7, 2018, 10:24am UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/15 "2018-06-07T10:24:11Z")

</div>

Can you share the activity screenshot with the property panel.

---

<div class="post-metadata">

**Author:** ![ysh325](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@ysh325](https://forum.uipath.com/u/ysh325)\
**Post date:** [October 10, 2018, 3:44am UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/16 "2018-10-10T03:44:53Z")

</div>

Hi,  
Try putting “true” in ContinueOnError option.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [October 29, 2018, 9:09am UTC](https://forum.uipath.com/t/how-to-use-kill-process/5743/17 "2018-10-29T09:09:11Z")

</div>

Closed on October 29, 2018, 9:09am UTC


