问题
I am currently developing an application in C# which needs to work sort of like a "Command Prompt", therefore I was wondering whether the C++ function
int system ( const char * command );
in cstdlib
exists in C#?
A reference to an dynamic-link library containing this function would be accepted aswell.
回答1:
Look into System.Diagnostics.Process.Start
: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx
回答2:
If you want to execute program from an application then you can use 'Process' class,it's insanely easy,
using System.Diagnostics;
class Program
{
static void Main()
{
Process.Start("MyApp.exe");
}
}
You might use a Console Application project template in Visual Studio,

来源:https://stackoverflow.com/questions/10806427/c-system-in-c-sharp