From: daz Date: 2005-10-20T15:11:58+09:00 Subject: Re: Killing Threads & Processes on Windows dave.burt... wrote: > nobuyoshi nakada wrote: > > Hi, > > > > At Wed, 19 Oct 2005 11:16:57 +0900, > > dave.burt... wrote in [ruby-talk:161280]: > > > You can write the WMI script in Ruby: > > > > > > require 'win32ole' > > > strComputer = "." > > > objWMIService = WIN32OLE.connect \ > > > ("winmgmts:\\#{strComputer}\root\cimv2") > > > colProcessList = objWMIService.ExecQuery \ > > > ("Select * from Win32_Process Where ProcessID = 3672") > > > colProcessList.each do |objProcess| > > > objProcess.Terminate() > > > end > > > > Does it work on Win9X? > > No, I don't think so -- [...] > True - needs WMI core 1.5 add-on -- see Run-Time Requirements here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/wmi_start_page.asp I wanted to point out, though, that passing a Ruby string to WIN32OLE.connect means those '\' must be doubled: ":\\\\.\\root\\cimv2" # 000 3a 5c 5c 2e 5c 72 6f 6f 74 5c 63 69 6d 76 32 :\\.\root\cimv2 .... rather than ... ":\\.\root\cimv2" # 000 3a 5c 2e 0d 6f 6f 74 09 6d 76 32 :\..oot.mv2 Alternatively, '/' appears to be accepted by WMI: "winmgmts://./root/cimv2" daz