Is there any method to display all currently running process full path and save in variable or list in C#?
I use "tasklist". But it only display process name and ID and nothing else...
and also I tried Process.GetProcesses()
, but I'munable to fetch full path.
Process[] processlist = Process.GetProcesses();
Console.WriteLine(processlist);
foreach (Process theprocess in processlist)
{
Console.WriteLine("Process: {0}\t\t\t\t\t\t ID: {1}", theprocess.ProcessName, theprocess.Id);
Console.WriteLine(theprocess);
}
Console.ReadKey()
I expect full path of running process like C:\WINDOWS\system32\example.exe
if example.exe is running on that time.