我想用C#在PuTTY中运行Unix命令。我有下面的代码。但代码不起作用。我无法打开PuTTY。在C#中使用PuTTY运行Unix命令
static void Main(string[] args)
{
Process cmd = new Process();
cmd.StartInfo.FileName = @"C:\Windows\System32\cmd";
cmd.StartInfo.UseShellExecute = false;
cmd.StartInfo.RedirectStandardInput = false;
cmd.StartInfo.RedirectStandardOutput = true;
cmd.Start();
cmd.StartInfo.Arguments = "C:\Users\win7\Desktop\putty.exe -ssh [email protected] 22 -pw mahi";
}
你已经走了有点不对劲有队友。看看http://stackoverflow.com/questions/6147203/automating-running-command-on-linux-from-windows-using-putty –