Get all processes on local machine : Process : Development C# Examples


C# Examples » Development » Process »

 

Get all processes on local machine









    
using  System;
using  System.Diagnostics;

class  MainClass
{
    static  void  Main(string[]  args)
    {
        Process[]  runningProcs  =  Process.GetProcesses(".");
        foreach(Process  p  in  runningProcs)
        {
            string  info  =  string.Format("->  PID:  {0}\tName:  {1}",p.Id,  p.ProcessName);                
            Console.WriteLine(info);
        }
    }
}
    
   
  
   



Output

-> PID: 1636    Name: explorer
-> PID: 1064    Name: svchost
-> PID: 884     Name: svchost
-> PID: 972     Name: svchost
-> PID: 1592    Name: postgres
-> PID: 700     Name: services
-> PID: 1140    Name: svchost
-> PID: 2472    Name: firefox
-> PID: 2560    Name: wuauclt
-> PID: 156     Name: atiptaxx
-> PID: 2908    Name: main
-> PID: 772     Name: wuauclt
-> PID: 1572    Name: ati2evxx
-> PID: 856     Name: cmd
-> PID: 320     Name: cachemgr
-> PID: 2808    Name: uedit32
-> PID: 1472    Name: postgres
-> PID: 848     Name: ati2evxx
-> PID: 1556    Name: postgres
-> PID: 128     Name: SynTPEnh
-> PID: 292     Name: ctfmon
-> PID: 568     Name: smss
-> PID: 656     Name: winlogon
-> PID: 388     Name: ICMON
-> PID: 716     Name: pg_ctl
-> PID: 116     Name: SynTPLpr
-> PID: 1272    Name: svchost
-> PID: 1716    Name: spoolsv
-> PID: 712     Name: lsass
-> PID: 1264    Name: postgres
-> PID: 1348    Name: postmaster
-> PID: 2504    Name: wscntfy
-> PID: 1168    Name: alg
-> PID: 632     Name: csrss
-> PID: 1876    Name: SWNETSUP
-> PID: 2764    Name: SWEEPSRV.SYS
-> PID: 4       Name: System
-> PID: 536     Name: imonitor
-> PID: 624     Name: TNSLSNR
-> PID: 0       Name: Idle


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Process