当我从命令提示符运行relog
命令时,我没有任何问题地获得输出。
现在,当我尝试使用C#代码运行命令时,我没有得到任何输出。可能是什么问题?
public static string Bash()
{
var process = new Process()
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
WorkingDirectory = @"C:\blgs",
Arguments = "relog.exe sample.blg",
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true,
}
};
process.Start();
string result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return result;
}