I've a problem with Unrar (called as C# process).
(I know there are several implementations for C#, but the most of them are buggy or they haven't the functions I need.)
As soon as I redirect one of the standard streams, Unrar skips all inputs (like passwort requests) and exits. But I want to provide these informations over the (redirected) standart input stream (p.StandardInput.Write ...)!
What's the Problem?
Process p = new Process();
p.StartInfo.FileName = "UnRAR.exe";
p.EnableRaisingEvents = true;
p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
p.ErrorDataReceived += new DataReceivedEventHandler(p_ErrorDataReceived);
p.StartInfo.Arguments = "l abc.rar";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
The Console shows the following:
UNRAR 4.10 freeware Copyright (c) 1993-2012 Alexander Roshal
Enter password (will not be echoed) for abc.rar:
CRC failed in the encrypted file abc.rar. Corrupt file or wrong password.
But as you see in my source I haven't send anything to the process (so it should wait after "Enter password" )
It seems as the process simply skips all the getch (or readLine()) commands and takes an empty string to continue.
Thanks for your answers.