I get the processes like this:

Process[] Proc; void startprocess() { Proc = Process.GetProcesses(); for (int i = 0; i < Proc.Length; i++) { ListViewItem itm2 = new ListViewItem(Proc[i].ProcessName + ".exe"); if (!listView1.Items.Contains(itm2)) { this.listView1.Items.Add(itm2); } } } 

Now I can not figure out how to open the folder to the lying file.

Tried to do so:

  foreach (ListViewItem item in listView1.SelectedItems) { Process.Start(new ProcessStartInfo("explorer.exe", @" /select," + item.Text)); } 

But always opens the same working folder.

    1 answer 1

    You need to know the full path to the process. This is done through

     Proc[i].MainModule.FileName 

    With the full name, you can easily get the directory:

     Path.GetDirectoryName(Proc[i].MainModule.FileName) 
    • But I do not understand where I replace it? - GooliveR
    • I invite you to chat to solve this problem. - GooliveR