class Program
{
public static void ExecuteCommand(string Command)
{
ProcessStartInfo ProcessInfo;
Process Process;
ProcessInfo = new ProcessStartInfo("cmd.exe", "/C " + Command);
ProcessInfo.CreateNoWindow = false;
ProcessInfo.UseShellExecute = false;
Process = Process.Start(ProcessInfo);
Process.WaitForExit();
Process.Close();
}
static void Main()
{
ExecuteCommand("telnet 169.254.0.1");
}
}
它运行 cmd 并通过 telnet 连接到特定设备。接下来,一旦连接,它会提示输入我也想发送的登录名和密码,然后是一些特定的命令。我应该怎么办?
非常感谢!