A strange phenomenon, in C # use process to start a process, the startup file name must be the system-specified extension. EXE, and I use the native Win32API:: CreateProcess () does not have this restriction, later encountered similar problems to pay attention to
The following example: Com.aaa,com.exe are the same executable file, but the extension is not the same
[TestMethod ()] Public void simple1111_test () { varnew System.Diagnostics.Process (); @" e:\com.aaa " ; var bb = process. Start ();}
The run failed, but the following test
[TestMethod ()] Public void simple1111_test () { varnew System.Diagnostics.Process (); @" E:\com.exe " ; var bb = process. Start ();}
Run successfully
Use the native Win32API test com.aaa below
sizeof (SI)}; Process_information Pi; = Startf_useshowwindow; = TRUE; =:: CreateProcess ( TEXT ("e:\\com.aaa"), null, null , null , FALSE, create_new_console, null, null, &si, &pi); int error = GetLastError ();
This is another success.
Indicates that the kernel did not detect the extension of the execution file, and the. NET Library Process class was detected
Testing for C # CreateProcess