用SFTP替换Windows命令FTP -s:E:\FtpScript.txt? [英] Replace Windows command FTP -s:E:\FtpScript.txt with SFTP?

查看:850
本文介绍了用SFTP替换Windows命令FTP -s:E:\FtpScript.txt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Windows脚本连接到常规FTP服务器并下载文件。

然而,这些文件已经被移至SFTP服务器。我如何修改以下脚本以连接到这个新的安全FTP服务器?我真的不想修改太多,因为它已经与以前的FTP服务器正常工作。



我在这里使用的ftp客户端是Windows中包含的ftp客户端。

脚本:

我有一个Windows任务运行以下命令: ftp -s:C:\files\FtpScript.txt

FtpScript.txt 包含以下内容:

 打开web.myserver.com 8021 
用户名
密码
lcd / Data / 2014/0113
提示符
get / var / opt / Data1200.xml
get /var/opt/Data1300.xml
get / var / opt / Data1400xml


解决方案

Windows命令行FTP客户端不支持SFTP协议。



您可以切换到WinSCP:


  • 替换您的命令行with:

      winscp.com /script=C:\files\FtpScript.txt 



    $ li $ <$> 打开sftp://用户名:password@web.myserver.com/


  • lcd 可以保留(虽然 / Data / 2014/0113 看起来不像本地路径)

  • 在WinSCP中, get 需要一个目标路径,使用 .\ 退出命令


  • ul>

    有关详细信息,请参阅使用Windows批处理脚本的Secure FTP或WinSCP指南用于将Windows FTP脚本转换为WinSCP SFTP脚本



    (我是WinSCP的作者)


    I have the following Windows script that connects to a regular FTP server and downloads files.

    However, the files have since been moved to an SFTP server. How can I modify the following script so that it connects to this new secure ftp server? I really don't want to modify too much since it had been working correctly with the past FTP server.

    The ftp client I'm using here is the one that's included with Windows.

    I'm including the script:

    I have a Windows task that runs the following: ftp -s:C:\files\FtpScript.txt

    FtpScript.txt has the following contents:

    open web.myserver.com 8021
    username
    password
    lcd /Data/2014/0113
    prompt
    get /var/opt/Data1200.xml
    get /var/opt/Data1300.xml
    get /var/opt/Data1400xml
    

    解决方案

    Windows command line FTP client does not support SFTP protocol.

    You can switch to WinSCP:

    • replace your command line with:

      winscp.com /script=C:\files\FtpScript.txt
      

    • replace your connection and authentication commands with:

      open sftp://username:password@web.myserver.com/
      

    • the lcd can stay (though /Data/2014/0113 does not look like a local path)

    • in WinSCP the get needs a target path, use .\ to download to the local current working directory.
    • add the exit command

    For details, see Secure FTP using Windows batch script or WinSCP guide for Converting Windows FTP script to WinSCP SFTP script

    (I'm the author of WinSCP)

    这篇关于用SFTP替换Windows命令FTP -s:E:\FtpScript.txt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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