C# 执行外部命令的代码
2021-06-05 05:03
标签:关于 cmd shel star public art start timeout comm C# 执行外部命令的代码 标签:关于 cmd shel star public art start timeout comm 原文地址:https://blog.51cto.com/14314834/2388692 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;
}
下一篇:C# 修改配置文件