使用Winscp在使用vb 2005的sftp站点中上载和下载文件 [英] using winscp to upload and download file in sftp site using vb 2005

查看:106
本文介绍了使用Winscp在使用vb 2005的sftp站点中上载和下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我的程序(控制台程序)中,我使用WinSCP ver. 4.3.8在SFTP站点/服务器中上载和下载文件.
以下是我的代码:

  Dim  _Host  As  字符串 = AppSettings.获取(" )
           Dim  _UserName  As  字符串 = ReturnValue(oSFTPConStr .GetValue( 1 ))
           Dim  _Password  As  字符串 = ReturnValue(oSFTPConStr .GetValue( 2 ))
           Dim  _InboxPath  As   String  = AppSettings.获取(" )
           Dim  _Port  As   String  = AppSettings.获取(" )

           Dim  nPath  As   String  = AppSettings.获取(" )
           Dim  nName  As   String  = AppSettings.获取(" )

          ' 创建所需的startinfo,以便程序在后台运行.
           Dim  startInfo  As  新建 ProcessStartInfo
          startInfo.FileName = _winScppath
          startInfo.RedirectStandardInput = 
          startInfo.RedirectStandardOutput = 
          startInfo.UseShellExecute = 错误
          startInfo.CreateNoWindow = 
          startInfo.WindowStyle = ProcessWindowStyle.Hidden

          ' 创建流程对象.
           Dim 流程 As   New 流程
          process.StartInfo = startInfo
          process.Start()

          ' 运行命令
          process.StandardInput.WriteLine("  + _Host)
          process.StandardInput.WriteLine(_UserName)
          process.StandardInput.WriteLine(_Password)
           Dim  ans = process.StandardOutput.ReadLine
          同时 ans<> 什么都没有
              如果 ans.Contains(" )然后
                  ans = ans
                  退出 同时
              结束 如果
              ans = process.StandardOutput.ReadLine
          结束 同时
          process.StandardInput.WriteLine("  + _InboxPath)
          process.StandardInput.WriteLine("  + _InboxFile& " & _LocalInbox)
          process.StandardInput.Close()
          process.WaitForExit( 1 )



该程序在Job Scheduled任务上运行,并且正在使用ASG-Zena创建计划运行. Zena是一个工作计划程序.

如何使用Zena Job Scheduler运行程序?请帮帮我.

解决方案

向编写该库的人员询问您的问题.您为图书馆付出了高昂的代价,图书馆也随之提供了支持,使用它 [ ^ ].


Hi,
In my program(console program), I using WinSCP ver. 4.3.8 to upload and download file in a SFTP site/server.
below is my code:

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)



the program runs on a Job Scheduled task, and were using ASG-Zena to create scheduled run. Zena is a job scheduler.

How can i run my program using Zena Job scheduler ? PLEASE Help Me.

解决方案

Ask your question with the people who wrote the library. You paid good money for the library and support came with it, use it[^].


这篇关于使用Winscp在使用vb 2005的sftp站点中上载和下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆