C#程序中调用CMD 指令,打开CMD窗口执行:

string command = "xxxx";
System.Diagnostics.Process.Start("CMD.exe", "/K " + command);

注意,参数 /K不能少。

 

参考:https://stackoverflow.com/questions/15878810/how-to-execute-command-on-cmd-from-c-sharp