My FTP batch script is stuck on "200 PORT command successful" and doesn't upload the files to server My FTP batch script is stuck on "200 PORT command successful" and doesn't upload the files to server windows windows

My FTP batch script is stuck on "200 PORT command successful" and doesn't upload the files to server


This looks like a typical problem with the FTP active mode. The server cannot connect back to your machine to establish a data transfer connection.

That typically happens as nowadays most client machines are behind a firewall or NAT or both, what prevents the FTP active mode from working. To make the active mode working you need to open your firewall (not recommended) and/or configure NAT routing rules.

See my article on FTP modes and configuring network for the active mode.


Or you use the passive FTP mode. The Windows ftp.exe client does not support the passive mode though, what makes it pretty useless nowadays.

So you need to use another command-line FTP client. A majority of FTP clients do support the passive mode.

For example with WinSCP your runScript.bat would be like:

winscp.com /command ^    "open ftp://username:password@myserver.com/" ^    "cd /public_html/reports/" ^    "lcd C:\automation\tests\HtmlReporter" ^    "put *" ^    "exit"

Note that WinSCP defaults to the passive mode.

For details see WinSCP guides for:

(I'm the author of WinSCP)


I had exactly the same problem ("200 PORT command successful" stuck on the screen forever), and I was able to solve it.

First of all, there are lot of posts on the Internet saying that Windows ftp.exe doesn't support passive mode. This is not true:

ftp> quote pasv

227 Entering Passive Mode

In my case I had a Windows 2012 R2 server with a real IP. Switching to the passive mode didn't solve the problem, I was still stuck at "200 PORT command successful". At the same time WinSCP worked fine. The solution was to create an inbound firewall rule which allowed external connections from FTP server to the local ftp.exe.