Using FTP via Command Line (CMD) on Windows 11

Published by Nyau Wai Hoe - Updated on

FTP, short for File Transfer Protocol, is a standard way to move files from one computer to another over the internet. Even though new ways to share files online have surfaced, FTP is still very useful, especially when you need to share big files or automate some tasks. This guide will show you how to use FTP commands on Windows 11 Command Prompt, step by step.

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

How to use FTP command line on Windows 11 CMD

What actually is FTP?

FTP is a well-known method to transfer files between a client and a server over a network. When the client asks for a file, the server will send it over. It works on a model where you can do things like download, upload, rename, and delete files on the server.

What you’ll need

Before you start, you’ll need:

  1. An FTP server up and running where you’ll be sending or getting files.
  2. The IP address or domain name of the FTP server so you can connect to it.
  3. Your FTP login details, like your username and password.

Expert guide: How to Download All Files From a Website Directory Using Wget

Accessing the FTP client on Windows 11

Windows 11 comes with an FTP client you can use right from the command line, no need for third-party software. First off, follow the steps below to open CMD:

  1. Hit the “Start” button and type “cmd” in the search bar.
  2. Click on “Command Prompt” to bring up the command-line interface.Open CMD Windows 11

Now that the command prompt is open, you’re ready to use FTP commands.

Downloading files usually doesn’t need special permissions, but sometimes you might need them, like when saving files to certain folders on your C:\ drive. If needed, right-click “Command Prompt” and choose “Run as administrator”.

Related resource: Downloading HTML from a Website

FTP commands for Windows (with examples)

The following are some common FTP commands and how to use them:

Connecting to an FTP server:

To connect, type the ftp command followed by the server’s name or IP.

ftp <hostname/IP>

For example, ftp ftp.example.com or ftp 192.0.2.0.

FTP command to Connect to an FTP server

Logging in with a username and password:

After connecting, you’ll be asked for your username and password.

ftp> user <username>
ftp> <password>

So, if your username is “john”, you would type user john and enter your password when asked.

Logging into FTP with a username and password using command line

Changing directory:

To go to another directory, use the cd command.

ftp> cd <directory-name>

Like, cd documents takes you to the “documents” directory.

FTP command line to change directory CMD

Listing files in a directory:

To see all files and folders where you are, use the dir command.

ftp> dir

FTP command to list directory CMD

Downloading a file:

To download a file from the server, use the get command with the file name.

ftp> get <file-name>

Like, get report.pdf would download “report.pdf”.

Windows FTP command line to download a file from FTP server

Uploading a file:

To send a file to the server, use the put command with the file name.

ftp> put <file-name>

Like, put report.pdf sends “report.pdf” to the server.

Windows FTP command to upload a file to server

Renaming a file:

To change a file’s name, use the rename command with the old and new names.

ftp> rename <old-file-name> <new-file-name>

For instance, rename oldfile.txt newfile.txt changes the name.

Windows 11 FTP command line to rename a file

Deleting a file:

To remove a file, use the delete command with the file name.

ftp> delete <file-name>

Like, delete unwantedfile.txt gets rid of “unwantedfile.txt”.

FTP command line to delete a file from the server

Creating a new directory:

To make a new folder on the server, use the mkdir command.

ftp> mkdir <directory-name>

For example, mkdir newfolder makes a ‘newfolder’ directory.

Create a new directory FTP command line on Windows 11

Removing a directory:

To delete a folder, use the rmdir command.

ftp> rmdir <directory-name>

Like, rmdir oldfolder will delete “oldfolder”.

Windows command line to remove a directory from FTP server

Closing the FTP connection:

When you’re done with the FTP session, you can close the connection with the close command.

ftp> close

Close FTP connection command line CMD

Exiting the FTP client:

To leave the FTP client, type the quit command.

ftp> quit

How to exit an FTP connection in Windows 11 CMD

Sample FTP Session

The following is an example of a quick FTP session using these commands:

C:\Users\YourUser> ftp ftp.example.com
Connected to ftp.example.com.
220 FTP Server ready.
ftp> user john
331 Please specify the password.
ftp> johnspassword
230 Login successful.
ftp> cd documents
250 Directory successfully changed.
ftp> dir
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 0 May 25 08:59 report.pdf
226 Directory send OK.
ftp> get report.pdf
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for report.pdf (0 bytes).
226 Transfer complete.
ftp: 0 bytes received in 0.00Seconds 0.00Kbytes/sec.
ftp> close
221 Goodbye.

Anonymous FTP

In some cases, servers let you log in as “anonymous”, usually asking for your email as the password. This kind of login is often read-only and meant for public file sharing, but it can raise security concerns.

FTP vs. SFTP

FTP is great but not very secure since it doesn’t encrypt the data being sent. That’s where SFTP comes in, providing nearly the same features as FTP but with added security, encrypting everything that’s transferred.

What are the risks with FTP

The biggest issue with FTP is its lack of encryption, meaning anyone can potentially see the data you’re transferring, including your login details and other private info. To fix this, FTPS and SFTP were created, adding encryption to make transferring files much safer.

Some final notes

FTP might be old, but it’s still a pretty important tool for many users and even businesses to move files around, even on Windows 11. This guide covered all the basics of using FTP commands. While FTP is powerful, don’t forget about its security risks (it’s widely known that FTP is no longer the most secure transfer method) and consider other more modern and safer file transfer options.

Categories: ComputingWindows 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