WinSCP returns exit code 1 when no apparent errors
Hello .... am using Server 2003 R2 with WinSCP 4.3.6 and .Net Automation in C#.
Am getting ExitCode = 1 on successful transer. No apparent errors in output or log.
These are attached.
relevant .net code:
winscp = new System.Diagnostics.Process();
winscp.StartInfo.FileName = "winscp.com";
winscp.StartInfo.Arguments = "/log=\"" + logname + "\"";
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open sftp://IBD:xxxxxx@ftp.bcliquor.com:22 -hostkey=\"ssh-dss 2048 82:a3:23:ef:81:7f:6e:f9:d9:95:10:f9:a7:d4:b1:ef\"");
winscp.StandardInput.WriteLine("cd Incoming");
winscp.StandardInput.WriteLine("put " + "\"" + batchFilePath + "\"");
winscp.StandardInput.Close();
// Collect all output
string output = winscp.StandardOutput.ReadToEnd();
// Wait until WinSCP finishes
winscp.WaitForExit();
int winscpExitCode = winscp.ExitCode;
winscp.Close();
Any help would be greatly appreciated.
regards
srdux@yahoo.com
Am getting ExitCode = 1 on successful transer. No apparent errors in output or log.
These are attached.
relevant .net code:
winscp = new System.Diagnostics.Process();
winscp.StartInfo.FileName = "winscp.com";
winscp.StartInfo.Arguments = "/log=\"" + logname + "\"";
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine("open sftp://IBD:xxxxxx@ftp.bcliquor.com:22 -hostkey=\"ssh-dss 2048 82:a3:23:ef:81:7f:6e:f9:d9:95:10:f9:a7:d4:b1:ef\"");
winscp.StandardInput.WriteLine("cd Incoming");
winscp.StandardInput.WriteLine("put " + "\"" + batchFilePath + "\"");
winscp.StandardInput.Close();
// Collect all output
string output = winscp.StandardOutput.ReadToEnd();
// Wait until WinSCP finishes
winscp.WaitForExit();
int winscpExitCode = winscp.ExitCode;
winscp.Close();
Any help would be greatly appreciated.
regards
srdux@yahoo.com