How to get the ID of all processes currently running in Windows with C#

1 Answer

0 votes
using System;
using System.Diagnostics;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Process[] processes = Process.GetProcesses();

            foreach (Process process in processes) {
                Console.WriteLine(process.Id);
            }

        }
    }
}


/*
run:

1772
7484
4328
5312
...

*/

 



answered Aug 10, 2018 by avibootz

Related questions

1 answer 332 views
1 answer 168 views
1 answer 266 views
266 views asked Mar 15, 2016 by avibootz
1 answer 216 views
1 answer 193 views
...