Well, "put" fails if session is not open. So the check you have there is enough.
- martin
Process m_WinSCP = new Process();
m_WinSCP.StartInfo.FileName = "WinSCP.com";
m_WinSCP.StartInfo.UseShellExecute = false;
m_WinSCP.StartInfo.RedirectStandardInput = true;
m_WinSCP.StartInfo.RedirectStandardOutput = true;
m_WinSCP.StartInfo.CreateNoWindow = true;
m_WinSCP.Start();
m_WinSCP.StandardInput.WriteLine("option batch abort");
m_WinSCP.StandardInput.WriteLine("option confirm off");
m_WinSCP.StandardInput.WriteLine("open ftp://127.0.0.1");
m_WinSCP.StandardInput.WriteLine("put myfile.txt");
m_WinSCP.StandardInput.Close();
m_WinSCP.WaitForExit();
if (0 == m_WinSCP.ExitCode)
{
//success
}