FTP 出现500 Invalid PORT Command.
我做了一个批处理文件用来下载服务器上的备份数据,以下是批处理文件的内容:
et o=\db\shoucw2013-08-19.rar
set i=h:\back\61.191.192.26\db\shoucw2013-08-19.rar
echo open 61.191.192.26 5505>>ftp.txt
echo ftpuser>>ftp.txt
echo cpn168>>ftp.txt
echo binary>>ftp.txt
echo liter PASV >>ftp.txt
rem echo nlist >>ftp.txt
echo get "%o%" "%i%">>ftp.txt
echo bye>>ftp.txt
ftp -s:"ftp.txt"
del ftp.txt
-----------------------
以下是输出内容:
ftp> open 61.191.192.26 5505
Connected to 61.191.192.26.
220 Microsoft FTP Service
User (61.191.192.26:(none)):
331 Password required for ftpuser.
230 User ftpuser logged in.
ftp> binary
200 Type set to I.
ftp> liter PASV
227 Entering Passive Mode (61,191,192,26,21,172).
ftp> get "\db\shoucw2013-08-19.rar" "h:\back\61.191.192.26\db\shoucw2013-08-19.r
ar"
500 Invalid PORT Command.
425 Can't open data connection.
-----------------------------------
提示一点,ftp服务端口由21改成了5505,passive那个命令也涌过来,服务器防火墙的端口也开放了5500-5550,最重要是用ftp软件是可以正常登陆服务器下载文件的。不知道为什么用批处理就会有上面的错误提示500 Invalid PORT Command.
------解决方案--------------------先不要用bat文件,在cmd窗口里面手工操作一下看看
ftp
open 61.191.192.26 5505
ftpuser
cpn168
binary
cd /db
get shoucw2013-08-19.rar