# How to Kill iexplore

**URL:** <https://www.ruby-forum.com/t/how-to-kill-iexplore/123882>\
**Category:** Ruby\
**Created:** [December 21, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/how-to-kill-iexplore/123882 "2007-12-21T17:59:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [December 21, 2007, 5:59pm UTC](https://www.ruby-forum.com/t/how-to-kill-iexplore/123882/1 "2007-12-21T17:59:30Z")

</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!

---

<div class="post-metadata">

**Author:** ![parvg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/bbe5ce/32.png) [@parvg](https://www.ruby-forum.com/u/parvg)\
**Post date:** [December 21, 2007, 8:01pm UTC](https://www.ruby-forum.com/t/how-to-kill-iexplore/123882/2 "2007-12-21T20:01:56Z")

</div>

On Dec 21, 9:59 am, “Parv G.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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)?

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|  
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.
