Run external application with no .exe extension

And to follow on from @yelnic. Try using cmd.exe /C myapp, I found it quite useful when I want a little more out of Process.Start().

using (Process process = Process.Start("cmd.exe") 
{
   // `cmd` variable can contain your executable without an `exe` extension
   process.Arguments = String.Format("/C \"{0} {1}\"", cmd, String.Join(" ", args));
   process.UseShellExecute  = false;
   process.RedirectStandardOutput = true;
   process.Start();
   process.WaitForExit();
   output = process.StandardOutput.ReadToEnd();
}

Key is to set the Process.StartInfo.UseShellExecute property to false prior to starting the process, e.g.:

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @"c:\tmp\test.bin";
p.StartInfo.UseShellExecute  = false;
p.Start();

This will start the process directly: instead of going through the "let's try to figure out the executable for the specified file extension" shell logic, the file will be considered to be executable itself.

Another syntax to achieve the same result might be:

var processStartInfo = new ProcessStartInfo
{
    FileName = @"c:\tmp\test.bin",
    UseShellExecute = false
};
Process.Start(processStartInfo);

Tags:

C#

.Net

Process