I have almost the same problem
I have two files a.exe in folder c:\one and a.exe in c:\two, both are running, but I want to delete the file only in the first folder
(If not this condition, I could use
foreach (var process in Process.GetProcessesByName("a.exe"))
process.Kill();
and then delete the file )
For almost the same problem was the answer RunOnce registry key, but I don't care if the user logs on or not, I just want to delete it now. Can you help me?