
Untitled
By: a guest on
May 6th, 2012 | syntax:
None | size: 0.74 KB | hits: 19 | expires: Never
Why do I get file not found excpetion with Interaction.Shell method?
int pid = Interaction.Shell(@"D:abc.txt", AppWinStyle.NormalNoFocus, false, -1);
int pid = Interaction.Shell(@"notepad.exe", AppWinStyle.NormalNoFocus, false, -1);
using (Process process = Process.Start(@"D:abc.txt"))
{
int pid = process.Id;
// Whether you want for it to exit, depends on your needs. Your
// Interaction.Shell() call above suggests you don't. But then
// you need to be aware that "pid" might not be valid when you
// you look at it, because the process may already be gone.
// A problem that would also arise with Interaction.Shell.
// process.WaitForExit();
}
int pid = Interaction.Shell(@"notepad.exe D:abc.txt", false, -1);