How do I find the Process ID of a program? I need to know it to attach a process for WinDbg. And, yes, I tried googling this question but everything seemed to be for a Linux system.

System.Diagnostics.Process.GetProcessesByName("process name")[0].Id;
System.Diagnostics.Process.GetProcessesByName("process name")[0].Id;

i get an exception on this code.

listBox1.Text = System.Diagnostics.Process.GetProcessesByName("AS")[0].Id.ToString();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.