I need to kill all Microsoft Word processes on a specific file
I have an overnight job that opens files and edits them then closes them again.
private void killprocess(string p)
{
foreach (Process proc in Process.GetProcessesByName(p).OrderBy(x=>x.Id))
{
proc.Kill();
}
}
This method kills all processes with specific name, in this case p="winword" BUT... I would like to kill all processes where p="winword" and FilePath = "C:\Temp\Test.docx". Any ideas?