How to get all instances of Notepad running on the local windows computer in C#

1 Answer

0 votes
using System;
using System.Diagnostics;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Process[] processesByName = Process.GetProcessesByName("notepad");

            foreach (var process in processesByName)
                Console.WriteLine(process);
        }
    }
}


/*
run:
 
System.Diagnostics.Process (notepad)
System.Diagnostics.Process (notepad)
System.Diagnostics.Process (notepad)
 
*/

 



answered Aug 11, 2018 by avibootz

Related questions

...