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/.
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/.
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.
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)?