Board logo

标题: [文件操作] ftp上传批处理一直出错,请朋友们指教! [打印本页]

作者: klqf    时间: 2019-3-20 15:45     标题: ftp上传批处理一直出错,请朋友们指教!

需要用批处理把H盘下的666.rar文件上传到FTP的111目录下,为什么批处理只能执行到登陆上FTP,但为什么不能上传文件呢?FTP服务软件为FileZilla Server,批处理win10下执行,ftp客户端软件上传meiwt。请朋友们帮忙指点一下。

批处理如下:
  1. @echo off
  2. echo open 121.48.139.217 >11.txt
  3. echo 123>>11.txt
  4. echo 123456>> 11.txt
  5. echo cd 111 >> 11.txt
  6. Echo binary>>11.txt
  7. Echo put h:\66.rar >> 11.txt
  8. Echo bye>>11.txt
  9. FTP -s:11.txt
复制代码
执行过程如下:
ftp> open 121.48.139.217
连接到 121.48.139.217。
220 欢迎登陆!
530 Please log in with USER and PASS first.
用户(121.48.139.217none)):
331 Password required for 123
230 Logged on
ftp> cd 111
250 CWD successful. "/111" is current directory.
ftp> binary
200 Type set to I
ftp> put h:\66.rar
200 Port command successful
150 Opening data channel for file upload to server of "/111/66.rar" -----卡在这一步了
作者: cutebe    时间: 2019-3-20 17:38

::put上传文件之前切换本地目录
lcd f:\
::put一般用相对路径
put 66.rar 66.rar
作者: Batcher    时间: 2019-3-20 18:57

试试:
https://blog.csdn.net/zhongqingshen/article/details/78161742
作者: klqf    时间: 2019-3-20 20:48

谢谢两位,改了相对路径,关闭的服务器和win10的防火墙,故障依旧
作者: Batcher    时间: 2019-3-20 20:53

回复 4# klqf


用WinSCP之类的FTP软件能上传吗?
打开一个CMD窗口手工一步一步的执行ftp命令能上传吗?
作者: yhcfsr    时间: 2019-3-20 21:16

分享下我常用的
  1. @echo off
  2. echo open FTP的IP 端口>ftp.up
  3. echo user 用户名 密码>>ftp.up
  4. Echo Cd 共享目录内的文件夹 >>ftp.up
  5. Echo binary>>ftp.up
  6. Echo prompt >>ftp.up
  7. Echo lcd "主机目录">>ftp.up
  8. Echo mput "*.*">>ftp.up
  9. echo bye>>ftp.up
  10. ftp -n -s:ftp.up
  11. del ftp.up
  12. pause
复制代码

作者: jiavip    时间: 2019-3-21 02:11

回复 4# klqf

给个建议!在写FTP 脚本的时候先用FTP纯命令执行一次。而且FTP脚本对空格要求极高。




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2