C++ “system()” in C#

时光怂恿深爱的人放手 提交于 2019-12-22 06:54:27

问题


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 cstdlibexists 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!