Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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

by Russ (Deacon)
on Jul 27, 2000 at 01:39 UTC ( #24585=categorized question: print w/replies, xml ) Need Help??
Contributed by Russ on Jul 27, 2000 at 01:39 UTC
Q&A  > programs and processes


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

I'd like to find and kill a process.

Answer: How can I see/manage the process list on Win32?
contributed by gaggio

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 ( 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.
Answer: How can I see/manage the process list on Win32?
contributed by talexb

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.

Answer: How can I see/manage the process list on Win32?
contributed by machinecraig

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.

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (3)
    As of 2020-10-25 23:51 GMT
    Find Nodes?
      Voting Booth?
      My favourite web site is:

      Results (249 votes). Check out past polls.