Search code examples
c#.netwin32exception

Error - file not found when it is definitely there


I am trying to run a process with System.Diagnostics.Process.Start(), but am getting the following error:

System.ComponentModel.Win32Exception: The system cannot find the file specified

I double checked the path, and even copied the string to a cmd window, where it ran just fine. What could be the problem?

I am using Win7 64 bit, the program I am trying to run was compiled with mingw64-x64, and I am compiling for .NET 2.0

EDIT
While trying to do the suggested

if (File.Exists(Your EXE)) {
}

I found that removing the flags from the command string solved the problem (I didn't think this was an issue and so didn't mention it before)

How do I run commands with parameters?


Solution

  • For arguments use this method. Or overload with ProcessStartInfo.