How to use passive FTP mode in Windows command prompt?

user2737208 picture user2737208 · Sep 5, 2013 · Viewed 340k times · Source

In Ubuntu ftp -p for passive mode works fine.

How do I do the same in Windows?

I tried with quote pasv but I am getting following error:

230 OK. Current restricted directory is /
ftp> quote pasv 
227 Entering Passive Mode (31,170,167,221,116,239)    
ftp> cd os    
250 OK. Current directory is /os    
ftp> dir    
500 I won't open a connection to 10.23.16.248 (only to 113.193.128.177)    
425 No data connection    
ftp>

My firewall is disabled.

Answer

Martin Prikryl picture Martin Prikryl · Mar 3, 2015

The Windows FTP command-line client (ftp.exe) does not support the passive mode, on any version of Windows. It makes it pretty useless nowadays due to ubiquitous firewalls and NATs.

Using the quote pasv won't help. It switches only the server to the passive mode, but not the client.


Use any thirdparty Windows FTP command-line client instead. Most other support the passive mode.

For example WinSCP defaults to the passive mode and there's a guide available for converting Windows FTP script to WinSCP script. If you are starting from the scratch, see the guide to automating file transfers to FTP using WinSCP. Also, WinSCP GUI can generate a script template for you.

(I'm the author of WinSCP)