In this guide, we’ll show you how to download a file from an FTP server using the Command Prompt (CMD) on Windows 11 or 10. The File Transfer Protocol (FTP) is commonly used to move files between computers over the internet. And CMD is a tool in Windows that lets you do a bunch of command-line tasks, like moving files around, without the need for any third-party software.
Also see: How to use FTP via command line on Windows 11
Page Contents
What you need first
Before we start, you need a few things:
- The FTP server’s address (like
ftp.example.com
) - A username and password for the FTP server, if it asks for one
- The exact path of the file you want (something like
/folder/subfolder/filename.extension
)
Expert guide: How to download all files from a website directory using Wget
How to get an FTP file with Command Prompt
Follow the steps below to download a file from an FTP site using CMD in Windows 11 or 10:
- Hit Win + X on your keyboard, and pick Windows Terminal (Windows 11) or Command Prompt (Windows 10) from the menu that pops up.
- Connect to the FTP server. Type this command in CMD, swapping ftp.example.com with the real FTP server’s address:
ftp ftp.example.com
You’ll know you’re connected when you see the FTP server’s welcome message.
- Log into the FTP server (if needed). If the server wants a username and password, it’ll ask. Put in your details to move forward.
Sometimes, you might have to type in your username and password yourself like this:user your_username your_password
Change your_username and your_password to what you actually use. After you’re in, you’ll see a message saying so.
- To peek at what’s in the current directory on the FTP server, type:
ls
This shows you all the files and folders there, helping you find the one you want to download.
- To make sure your file comes over correctly, switch to binary mode by typing:
binary
- Decide where on your computer you want to save the file you’re getting. Type this, but replace C:\destination_folder with where you want it to go:
lcd C:\destination_folder
- Now, download the file with the get command. Swap out /folder/subfolder/filename.extension with the file’s actual location on the server:
get /folder/subfolder/filename.extension
You’ll see a message when the file has finished moving.
- Close the FTP connection by typing:
bye exit
Congrats! You’ve just downloaded a file from an FTP server using only Command Prompt in Windows 11 or 10. This way, you can get files without needing any extra FTP software, which should save you time and money.
Useful tip: How to run Batch File without the CMD window
Quick single command download
Besides the step-by-step method, there’s a quick way to download an FTP file using just one line of command in CMD. This is great if you like to keep things simple and fast.
Here’s the magic one-liner:
echo open WEBSITE >> ftp &echo user USERNAME PASSWORD >> ftp &echo binary >> ftp &echo get PATHTOFILE >> ftp &echo bye >> ftp &ftp -n -v -s:ftp &del ftp
Switch out these bits with your details:
WEBSITE
: Your FTP server’s address (like ftp.example.com)USERNAME
: Your FTP usernamePASSWORD
: Your FTP passwordPATHTOFILE
: Where the file lives on the server (like /folder/subfolder/filename.extension)
This single command line does it all: connects, logs you in, gets your file, and closes the session. It even cleans up by deleting a temp file it made. Though it’s speedy, it’s better for folks who don’t mind not seeing what’s happening step by step.
Before you use this command, make sure you’re in the folder where you want the file to go. To change directories in CMD, type:
cd C:\destination_folder
Swap C:\destination_folder
with your folder. Once you’re there, use the one-liner above to quickly grab your FTP file.
Related resource: Copy folder structure without files in Windows 11/10
How to download many files at once with “mget”
When you need to download a bunch of files from an FTP server all at the same time, the mget
command is your friend. It’s perfect for saving time when you’ve got lots of files to download.
Before you start downloading, make sure you’re in the right folder on the FTP server where the files you want are. To download everything in the folder, use mget *.*
. The *.*
means “grab all files.” If you’re after just a specific type of file, like text files, change *.*
to *.txt
.
Here’s the command:
mget *.*
After you run this, you’ll get asked for each file if you want to download it. Answer with yes (y
) or no (n
). If there’s a long list of files and you know you want all of them, constantly replying can sometimes be quite annoying. To skip this step, activate automatic yes responses by entering this command before starting with mget
:
prompt
This turns off the confirmation for each file, so the download starts right away without asking. Don’t forget to switch prompting back on after by typing prompt
again, to avoid unwanted downloads in the future.