我想用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 –