I made a C# program that inputs ftp commands into cmd.exe, it will read the output and displays it on the console. The problem is, it gets stuck when reading the output of Console.WriteLine(srFTP.ReadToEnd()); The debugger does not show any errors. It simply gets stuck. I tried putting console.writelines on each line and it proved that it was stuck at that point. Help?
public static void CheckKVSConnect()
{
Process KVSFTP = new Process();
KVSFTP.StartInfo.FileName = "cmd.exe";
KVSFTP.StartInfo.Arguments = "disable";
KVSFTP.StartInfo.UseShellExecute = false;
KVSFTP.StartInfo.RedirectStandardOutput = true;
KVSFTP.StartInfo.RedirectStandardInput = true;
KVSFTP.StartInfo.RedirectStandardError = true;
KVSFTP.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
KVSFTP.Start();
StreamWriter swFTP = KVSFTP.StandardInput;
swFTP.WriteLine("ftp");
swFTP.WriteLine("open aaaaaa.org");
swFTP.WriteLine("username");
swFTP.WriteLine("password");
StreamReader srFTP = KVSFTP.StandardOutput;
Console.WriteLine(srFTP.ReadToEnd());
Console.WriteLine("DONE");
}