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 322 views
1 answer 137 views
1 answer 238 views
238 views asked Mar 15, 2016 by avibootz
1 answer 204 views
1 answer 182 views
...