How to retrieve the full path of the notepad file if it is saved in drive. For example a notepad process is running and it is saved somewhere in the drive. How can I retrieve its full path? Using below code I can get the process detail, but not the actual path of particular files.
Process[] localByName = Process.GetProcessesByName("notepad");
foreach (Process p in localByName)
{
string path = p.MainModule.FileName.ToString();
}
this returns C:\WINDOWS\system32\NOTEPAD.EXE I also want to get saved location of file.