How do I upload files using the command line on Windows?

Open Windows CMD, type ftp and these commands:

ftp> open 123.4.567.89
ftp> user ftp_username ftp_password
ftp> cd folder1/folder2
ftp> quote pasv
ftp> binary
ftp> send C:\uploadfile.txt
ftp> disconnect  
ftp> quit  
  • 123.4.567.89 is the IP of your FTP server
  • ftp_username is the username to login on your FTP server
  • ftp_password is the password to login on FTP server
  • folder1/folder2 is the path on your FTP server where your file should be uploaded to
  • C:\uploadfile.txt is the path to your local file which should be uploaded

Read more


While, in some cases, you can use the Windows command-line ftp.exe client, as the answer by @nixda shows, in most cases you cannot. The ftp.exe does not support a passive mode, what makes it useless nowadays, when connecting over Internet due to ubiquitous firewalls and NATs.

Also nowadays you better use FTPS (an encrypted variant of FTP), what is also not supported by ftp.exe.

You better use any 3rd party FTP command-line client. Most do support the passive mode and FTPS.

For example with WinSCP scripting, you can use a batch file like:

winscp.com /log=upload.log /command ^
    "open ftpes://username:[email protected]/" ^
    "put ""C:\local\path\file.dat"" ""/remote/path/file.dat""" ^
    "exit"

There's even a guide for converting Windows ftp.exe script to WinSCP script.

(I'm the author of WinSCP)


Use the page Microsoft Windows Command-Line FTP Command List.