Dim _Host As String = AppSettings.Get("sftp_Host") Dim _UserName As String = ReturnValue(oSFTPConStr.GetValue(1)) Dim _Password As String = ReturnValue(oSFTPConStr.GetValue(2)) Dim _InboxPath As String = AppSettings.Get("sftp_inFolder") Dim _Port As String = AppSettings.Get("sftpPort") Dim nPath As String = AppSettings.Get("sftp_Folder") Dim nName As String = AppSettings.Get("cTextFileName") 'create the required startinfo for program to run in background. Dim startInfo As New ProcessStartInfo startInfo.FileName = _winScppath startInfo.RedirectStandardInput = True startInfo.RedirectStandardOutput = True startInfo.UseShellExecute = False startInfo.CreateNoWindow = True startInfo.WindowStyle = ProcessWindowStyle.Hidden 'create the process object. Dim process As New Process process.StartInfo = startInfo process.Start() 'run the commands process.StandardInput.WriteLine("open " + _Host) process.StandardInput.WriteLine(_UserName) process.StandardInput.WriteLine(_Password) Dim ans = process.StandardOutput.ReadLine While ans <> Nothing If ans.Contains("Session started.") Then ans = ans Exit While End If ans = process.StandardOutput.ReadLine End While process.StandardInput.WriteLine("cd " + _InboxPath) process.StandardInput.WriteLine(" get " + _InboxFile & " " & _LocalInbox) process.StandardInput.Close() process.WaitForExit(1)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)