我有一个问题:如何创建 .sh 文件以在 C# 中执行 Visual Studio 2010 控制台项目?谢谢!
问问题
1440 次
1 回答
0
你的意思是运行一个bash脚本吗?我发现了这个
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "/tmp/bash.sh";
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.Arguments = "test";
Process p = Process.Start(psi);
string strOutput = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Console.WriteLine(strOutput);
}
于 2013-03-07T18:19:13.890 回答