Win32Exception (0x80004005): The system can not find the file specified in System.Diagnostics.Process.StartWithCreateProcess (ProcessStartInfo startInfo)
When trying to run a newly published program I came across this error, which refers to an external application to my application, called by the code snippet I mention below:
private void CreatePorts(string command, bool ports)
{
Process p = new Process();
p.StartInfo.WorkingDirectory = (Application.StartupPath + @"\com0com");
p.StartInfo.FileName = @"setupc.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.LoadUserProfile = true;
p.StartInfo.Verb = @"runas";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.Arguments = " " + command;
p.Start();
}
It is certain that the address passed to the parameter WorkingDirectory
is correct and that the file mentioned in the parameter FileName
exists, so I do not understand what is wrong.