# How to Kill iexplore

**URL:** <https://rubytalk.org/t/how-to-kill-iexplore/43202>\
**Category:** ruby-talk\
**Created:** [21 December 2007 16:59 UTC](https://rubytalk.org/t/how-to-kill-iexplore/43202 "2007-12-21T16:59:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parv\_G](https://avatars.discourse-cdn.com/v4/letter/p/e9c0ed/32.png) [@Parv\_G](https://rubytalk.org/u/Parv_G)\
**Post date:** [21 December 2007 16:59 UTC](https://rubytalk.org/t/how-to-kill-iexplore/43202/1 "2007-12-21T16:59:26Z")

</div>

Hi,

Can anybody give a code example on how to kill a process using the  
"image name" (in windows task manager)?

is there something like Process.kill\_image(image\_name)?

Thanks!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Daniel\_Berger2](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/daniel_berger2/32/2243_2.png) [@Daniel\_Berger2](https://rubytalk.org/u/Daniel_Berger2)\
**Post date:** [21 December 2007 19:00 UTC](https://rubytalk.org/t/how-to-kill-iexplore/43202/2 "2007-12-21T19:00:43Z")

</div>

No, because that would kill all processes with that name. You can do  
this:

require 'sys/proctable'  
require 'win32/process'  
include Sys

ProcTable.ps do |process|  
&nbsp;&nbsp;&nbsp;Process.kill(1, process.pid) if process.caption == image\_name  
end

I recommend require'ing win32/process so you get the better  
Process.kill version.

Regards,

Dan

PS - I just discovered that you'll need to add "require 'time'" to the  
top of the proctable.rb (windows.rb) file. It's fixed in CVS.

> **···**
>
> On Dec 21, 9:59 am, "Parv G." \<ghotr...@yahoo.com\> wrote:
> 
> > Hi,
> > 
> > Can anybody give a code example on how to kill a process using the  
> > "image name" (in windows task manager)?
> > 
> > is there something like Process.kill\_image(image\_name)?
