From: x1 Date: 2005-11-10T10:06:28+09:00 Subject: Re: Killing Threads & Processes on Windows for future reference to others and thanks to dave. There was a small issue with backslashes and escapes in the example dave gave us.... Very small prob but.. wanted to inform others who may stumble on this.. Here's what worked for me in the end: require 'win32ole' def start_process(command) return IO.popen(command).pid end def kill_process(pid) strComputer = "." objWMIService = WIN32OLE.connect \ ("winmgmts:\\\\#{strComputer}\\root\\cimv2") colProcessList = objWMIService.ExecQuery \ ("Select * from Win32_Process Where ProcessID = #{x.to_s}") colProcessList.each do |objProcess| objProcess.Terminate() end return "done" end command = "c:/program files/internet explorer/iexplore.exe" pid = start_process(command) puts "killing pid now (#{pid}).." sleep 1 #probably not needed puts kill_process(pid) On 10/27/05, Warren Seltzer wrote: > You can do WMI in Ruby. There's a library already built for this. > > Warren Seltzer > > P.S. Have you ever seen such a hellacious mess as WMI? > > > >