如何在 windows 批处理文件中编写命令以将 zip 文件从 FTP 路径复制到我计算机中的本地文件夹

How to write command in windows batch file to copy a zip file from an FTP path to a local folder in my computer

我想将一个 zip 文件从 FTP 路径复制到我计算机中的本地文件夹。

我的客户以前使用 coreftp.exe 来达到这个目的。但是现在他要求我们使用 ftp.exe [default in windows machine, available at C :\Windows\System32\ftp.exe] 用于此目的。 ftp 的格式为:

ftp://username@ftpserver.address.com 

并想将其下载到我机器上的 d:\sample\docs 文件夹中。

我想要在批处理文件中,以便我可以通过 windows 任务管理器安排它。

那么你能帮我把那个命令写在批处理文件上吗?

非常感谢。

FTP.EXE 可以执行脚本文件。所以你可以把它放到你的 bat 文件中:

@ECHO OFF
CD d:\sample\docs
FTP -v -i -s:C:\some\path\ftpscript.txt

在您的 ftpscript.txt 中添加类似这样的内容:

open ftp://ftpserver.address.com
username
password
cd myfolder
get some_zip_file.zip
disconnect
bye

这会将 some_zip_file.zip 下载到当前目录 (d:\sample\docs)。