Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

How can I see/manage the process list on Win32?

by Russ (Deacon)
on Jul 27, 2000 at 01:39 UTC ( [id://24585]=perlquestion: print w/replies, xml ) Need Help??

Russ has asked for the wisdom of the Perl Monks concerning the following question: (programs and processes)

How can I see/manage the process list on Win32?

I'd like to find and kill a process.

Originally posted as a Categorized Question.

  • Comment on How can I see/manage the process list on Win32?

Replies are listed 'Best First'.
Re: How can I see/manage the process list on Win32?
by gaggio (Friar) on Jul 27, 2000 at 18:26 UTC

    To get the process list (a hash with the pids as a key, use my function). As said before, this function works for the local machine or for a remote machine - just give the ip you want (127.0.0.1 for the local machine).

    Then you can just find the pid you want to kill (by doing a search on the processes names, probably) and use the function Win32::Process::KillProcess, like this:
    my $actually_killed = Win32::Process::KillProcess($pid,0);
    Please note that you should check that the function is returning the pid you killed, to test if it did it OK.
Re: How can I see/manage the process list on Win32?
by talexb (Chancellor) on Sep 17, 2002 at 19:36 UTC
    As an addendum to gaggio's answer, please note that this works only on Windows ME, 2000 and NT and does not work for Windows 95 or 98, probably due to differences in architecture.
Re: How can I see/manage the process list on Win32?
by machinecraig (Monk) on Feb 06, 2005 at 11:08 UTC
    This is not a perl solution, but I've had very good sucess with using a tool from the guys at Sysinternals. Check out their psutils. In their utility package, pslist.exe will most likely do everything you need.

    Another great solution is to check out the GNU Utilities that have been blessed with Windows ports. There's also probably, almost definitely, a ResKit utility. I know none of these solutions are perlish, but IMHO - it makes more sense to call a small executable then to have to write up an implementation of ps.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://24585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-25 09:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found