How can I get a path of a running process by name? For example, I know there is a process named \"notepad\" running, and I want to get the path of it. How to get the path wi
There are really two approaches you can take.
You can do process by name:
Process result = Process.GetProcessesByName( "Notepad.exe" ).FirstOrDefault( );
or you could do what you do but use linq
Process element = ( from p in Process.GetProcesses()
where p.ProcessName == "Notepad.exe"
select p ).FirstOrDefault( );