Posted by: dcsaha | November 14, 2010

How to use Windows Command-line FTP.EXE for Passive Mode Data Transfer

Many people just have this wrong notion that windows command line FTP.exe can not be run in passive mode. It actually can be configured to run. The (undocumented or not well documented in ftp help) QUOTE command is the key here. QUOTE PASV command will set the FTP client to work in passive mode. Below is an example:

ftp>quote pasv

To run a sequence of FTP command from a file you may use Batch command or VBScript. First create your ftp command file (say ftp.txt) in note pad. The content of the file would be as below. Replace the fields with in [] with appropriate values:

open []
quote pasv

Simply write the following in a batch file (say ftp.bat) to execute the ftp.txt content:

c:\windows\system32\ftp.exe -s:c:\ftp.txt

If you want to use VBScript, create a VBScript file (say ftp.vbs) in notepad as well. The content of the script file would be as below:

Set objShell = CreateObject("WScript.Shell")
objShell.Run "c:\windows\system32\ftp.exe -s:c:\ftp.txt", , True
Set objShell = Nothing

Double click on ftp.vbs and voila!






  1. is not working

    • There were some error in batch file commands, corrected now.

  2. The quote pasv command will only put the server in passive mode.

    to fix this you need an ftp client like:

    which will run in passive mode.

    • Agreed, only the server is in PASV mode, not the client.

      As already mentioned, there is ‘Passive-ftp.’ (for ~$60) and there is NCFTP ( which works a little different but free.

  3. Doesn’t work… Looks like the ftp client is able to send PASV command but doesn’t understand it so now both sides have data connection listener ports.

    quote pasv is useless.

    ftp> open
    Connected to
    220 (vsFTPd 2.0.5)
    User ( anonymous
    331 Please specify the password.
    230 Login successful.
    ftp> quote pasv
    227 Entering Passive Mode (NNN,109,139,134,83,169)
    ftp> ls
    200 PORT command successful. Consider using PASV.
    Aborting any active data connections…

    The last ‘200 PORT command successful’ was hang forever, so I just hit CTRL+C

  4. You could always use this:

    I had forgotten this was an issue, and that I solved it using WinSCP instead.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: