【发布时间】:2021-11-10 16:30:10
【问题描述】:
我正在尝试使用 C# 在 PuTTY 中运行 Unix 命令。我有下面的代码。但是代码不起作用。我无法打开 PuTTY。
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 mahi@192.168.37.129 22 -pw mahi";
}
【问题讨论】:
-
你有点不对劲,伙计。看看stackoverflow.com/questions/6147203/…