Ida*_*n E 8 windows ftp automation batch-file
我已经尝试过在Google搜索结果中找到的所有内容
200 PORT命令成功
但没有任何帮助.
有人可以协助解决这个问题吗?
"runScript.bat的代码:
ftp -s:"C:\automation\fileup.bat" myserver.com
Run Code Online (Sandbox Code Playgroud)
"fileup.bat的代码:
username
password
ascii
cd "/public_html/reports/"
lcd "C:\automation\tests\HtmlReporter"
prompt
mput *
disconnect
close
bye
Run Code Online (Sandbox Code Playgroud)
控制台日志:
C:\automation>ftp -s:"C:\automation\fileup.bat" myserver.com
Connected to myserver.com.
220---------- Welcome to Pure-FTPd [privsep] ----------
220-You are user number 7 of 500 allowed.
220-Local time is now 04:40. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
User (server26.000webhost.com:(none)):
331 User username OK. Password required
230-OK. Current restricted directory is /
230-449 files used (4%) - authorized: 10000 files
230 16742 Kbytes used (1%) - authorized: 1536000 Kb
ftp> ascii
200 TYPE is now ASCII
ftp> cd "/public_html/reports/"
250 OK. Current directory is /public_html/reports
ftp> lcd "C:\automation\tests\HtmlReporter"
Local directory now C:\automation\tests\HtmlReporter.
ftp> prompt
Interactive mode Off .
ftp> mput *
200 PORT command successful
Run Code Online (Sandbox Code Playgroud)
关于WinSCP(对于Martin)的错误":
C:\Users\idan>cd c:\automation\
c:\automation>runFTP.bat
c:\automation>winscp.com /command "open ftp://user:pass@myserver.com/" "cd /public_html/reports/" "lcd C:\automation\tests\HtmlRepo
rter" "put *" "exit"
'winscp.com' is not recognized as an internal or external command,
operable program or batch file.
c:\automation>
Run Code Online (Sandbox Code Playgroud)
Mar*_*ryl 13
这看起来像FTP活动模式的典型问题.服务器无法连接回您的计算机以建立数据传输连接.
这通常发生在如今大多数客户端机器都在防火墙或NAT之后或两者之间,这阻止了FTP活动模式的工作.要使活动模式工作,您需要打开防火墙(不推荐)和/或配置NAT路由规则.
请参阅我关于FTP模式的文章和为活动模式配置网络.
或者您使用被动FTP模式.Windows ftp.exe客户端虽然不支持被动模式,但是现在它变得毫无用处.
所以你需要使用另一个命令行FTP客户端.大多数FTP客户端都支持被动模式.
例如,使用WinSCP,你runScript.bat会是这样的:
winscp.com /command ^
"open ftp://username:password@myserver.com/" ^
"cd /public_html/reports/" ^
"lcd C:\automation\tests\HtmlReporter" ^
"put *" ^
"exit"
Run Code Online (Sandbox Code Playgroud)
请注意,WinSCP默认为被动模式.
有关详细信息,请参阅WinSCP指南:
(我是WinSCP的作者)
| 归档时间: |
|
| 查看次数: |
21523 次 |
| 最近记录: |