How to Download an FTP File Using CMD in Windows 11/10

Published by Nyau Wai Hoe - Updated on

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) lets you move files between computers over the internet. And CMD? It’s a tool in Windows that lets you do a bunch of computer tasks, like moving files around, without needing extra software.

Also see: How to use FTP via command line on Windows 11

How to Download an FTP File Using CMD in Windows 11

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 these steps to download a file from an FTP site using CMD in Windows 11 or 10:

  1. Open CMD: Hit Win + X on your keyboard, and pick Windows Terminal (Windows 11) or Command Prompt (Windows 10) from the menu that pops up.
  2. 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.Connect to FTP server using CMD in Windows 11

  3. 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.Login to FTP server via CMD in Windows

  4. See what’s in the directory: 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.List FTP server directory and files in CMD Windows

  5. Switch to binary mode: To make sure your file comes over correctly, switch to binary mode by typing:
    binary

    Binary FTP CMD Windows 11

  6. Pick where to save the file: 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

    Change download directory for FTP file in CMD

  7. Download the file: Now, grab 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.Download FTP files from CMD in Windows 11

  8. Close the FTP connection: To wrap things up, type:
    bye
    exit

Congrats! You’ve just downloaded a file from an FTP server using 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

Download an FTP file using only one command line

Switch out these bits with your details:

  • WEBSITE: Your FTP server’s address (like ftp.example.com)
  • USERNAME: Your FTP username
  • PASSWORD: Your FTP password
  • PATHTOFILE: 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.

Categories: Windows 10Windows 11

Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of WindowsDigitals.com. With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link