如何从进程ID获取FullName(路径)
例如,如果int id = 234
如何找到id的位置;
int Id = Convert.ToInt32(lvprocesslist.SelectedItems[0].SubItems[1].Text);
string s = Process.GetProcessById(Id).MainModule.FileName;
Console.WriteLine(Path.GetFullPath(s));
Run Code Online (Sandbox Code Playgroud)
它不能在Windows PID下运行(记事本3704)无法正常工作
谢谢.
你可以试试这个
string s = Process.GetProcessById(2028).MainModule.FileName;
Run Code Online (Sandbox Code Playgroud)