[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

list of win32 processes

Junkone

1/8/2008 11:36:00 AM

I need to get list of processes running on windows with process names
and pids. is there any api that will do it. i was looking at win32/
process and could not fidn a function that will provide list of
existing running processes.
1 Answer

Lars Christensen

1/8/2008 12:42:00 PM

0

On Jan 8, 12:36 pm, Junkone <junko...@gmail.com> wrote:
> I need to get list of processes running on windows with process names
> and pids. is there any api that will do it. i was looking at win32/
> process and could not fidn a function that will provide list of
> existing running processes.

Try sys/proctable:

irb(main):002:0> require 'sys/proctable'
=> false
irb(main):002:0> require 'time' # dependency of sys/proctable
=> false
irb(main):003:0> Sys::ProcTable.ps.find { |p| p.name ==
"ruby.exe" }.pid
=> 600


Lars