Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Russ (Deacon)
on Jul 27, 2000 at 01:39 UTC ( #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 (Canon) 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
Node Status?
node history
Node Type: perlquestion [id://24585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2021-04-21 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?