I launch an executable in the usual way:
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.WorkingDirectory = @"C:\someDirectory\";
p.StartInfo.FileName = "ConsoleProgram.exe";
p.Start();
Currently, the executable is not in C:\someDirectory\, so I want the above to fail due to an executable that was not found.
Instead, what it does is that it, for some reasons, locates a different executable by the same name on my Desktop! (I know this because if I rename the .exe on the Desktop, the software complains about a .exe that wasn’t found.) How can I prevent this behavior, and enforce a particular path and no other path?
Add the complete path info to FileName.