windows - 服务器端 FTP 批处理脚本

标签 windows batch-file server ftp-client

我一直在使用 .bat 脚本从 FTP 服务器仅下载 pdf。

到目前为止,它一直使用 mget *pdf 函数完美运行。

我最近移动了脚本并让它从 Windows 2012 Server 运行。

现在,当脚本到达 mget 函数时,它会列出通常会传输的文件,但带有 ?在每个实例之后,它都无法将它们实际下载到液晶显示器。

@ftp -v -n -i -s:C:\Users\LMCT\Desktop\Serversidesage\download-1.txt

这是正在调用的 FTP 函数。

open xx.xxx.xx.xxx
user xxxxxxxxxxx
=xxxxxxxxxxxx
cd orders
lcd "C:\Users\LMCT\Desktop\Magento-downloaded-orders"
binary
prompt
mget *pdf
mdelete *pdf
quit

这是下载脚本。

有谁知道为什么会这样?

提前致谢。

亲切的问候,刘易斯。

最佳答案

默认情况下,交互式提示是打开的。当您使用 -I 选项启动 FTP 命令时,它会关闭提示。在您的脚本中,您随后使用 PROMPT 命令将其重新打开,该命令随后将关闭您的 MGET 命令。

因此,如果 PROMPT 命令在您的 FTP 脚本中:

open ftp.domain.com
user ftpuser
password
prompt
quit

很容易测试,看看发生了什么。

C:\BatchFiles\ftp>ftp -v -i -n -s:"script.txt" |find "Interactive"
Interactive mode On .

C:\BatchFiles\ftp>ftp -v -n -s:"script.txt" |find "Interactive"
Interactive mode Off .

关于windows - 服务器端 FTP 批处理脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40547804/

相关文章:

Windows路径环境变量

windows - 删除旧版本的 Ruby(在 Windows 上)

python - 在 Python 脚本中运行批处理文件时出现 Windows 错误 2

function - 批处理脚本中的 IP 验证 - 首先通过 findstr 进行匹配,然后通过 for 循环进行验证(仅使用内置功能的窗口?

mysql - kamailio 启动失败错误 : PID file does not exist

windows - 如何使文件真正不可变(不可删除且只读)?

c# - .NET native Windows 商店发布

batch-file - 从失败的FIND命令进行批量编程设置ERRORLEVEL

java - 有什么理由不应该预编译 JSP 页面吗?

java - 如何扩展 ReceiverAdapter 和 java.rmi.server.UnicastRemoteObject