C# 执行外部命令的代码
下面代码内容是关于C# 执行外部命令的代码,应该对大家有用。
public static int executeCommand(string cmd, int millsecTimeOut) { System.Diagnostics.ProcessStartInfo processStartInfo = new System.Diagnostics.ProcessStartInfo("CMD.exe", "/C "+cmd); processStartInfo.CreateNoWindow = true; processStartInfo.UseShellExecute = false; System.Diagnostics.Process process = System.Diagnostics.Process.Start(processStartInfo); int exitCode = process.ExitCode; process.Close(); return exitCode; }
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。