 <p>In .Net, I found that the above method didn't work quite as expected. The trick was to use .Net's built-in input redirection - and not the <code>&lt;</code> operator. Here's what the code looks like now:</p> <pre class="lang-csharp prettyprint-override"><code>System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.EnableRaisingEvents = false; proc.StartInfo.FileName = "c:\\psftp.exe"; proc.StartInfo.UseShellExecute = false; proc.StartInfo.RedirectStandardInput = true; proc.StartInfo.Arguments = strIP + " -v -l " + strUsername + " -pw " + strPassword + " -b " + strBatchFilename; proc.Start(); StreamWriter myStreamWriter = proc.StandardInput; myStreamWriter.WriteLine("Y\n"); //override the public key question &lt;--- myStreamWriter.Close(); proc.WaitForExit(); proc.Close(); </code></pre>