28, May 2012

Windows : How to see the running processes - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Windows : How to see the running processes
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Windows : How to see the running processes  (Read 1810 times)
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« on: Aug 30, 2005, 02:26:24 pm »

I know it is almost useless but I thought it may be usefull to someone out there :

Code:
<?php 
function tasklist()
{
    
ob_start();
    
passthru("tasklist");
    
$ret ob_get_clean();
    
    
$ret explode"\n"$ret);
    
//Key lenghts:
    
$lengths explode(" "$ret[2]);
    for ( 
$i=0$i count($lengths); $i++)
    {
        
$lengths[$i] = strlen($lengths[$i]) + 1;
    }
    
    
$tasks = array();
    for ( 
$i=3$i count($ret); $i++)
    {
        
$tasks[] = array(
            
"Name" => trim substr $ret[$i], 0$lengths[0]) ),
            
"PID" => trim substr$ret[$i], $lengths[0], $lengths[1]) ),
            
"SessionName" => trim substr$ret[$i], $lengths[1] + $lengths[0], $lengths[2]) ),
            
"Session" => trim substr$ret[$i], $lengths[2] + $lengths[1] + $lengths[0], $lengths[3]) ),
            
"Memory" => trim substr$ret[$i], $lengths[3] + $lengths[2] + $lengths[1] + $lengths[0], $lengths[4]) )
        );
    }
    return 
$tasks;
}
?>


The function returns an associative array which you can use as you want.
To check it out execute this :

Code:
<?
var_dump ( tasklist() );
?>

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=48
Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Windows : How to see the running processes
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 03:52:07 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.