Windows

Basic Command Prompt Commands To Start Learning CMD (CD, DIR, MKDIR, REN, RD…)

  • Learn the most basic Command Prompt commands (CMD) that also work in the more advanced PowerShell.
  • The Command Prompt dates back to MS-DOS, and can still be used today, even in Windows 11.
  • Typing to get things done in Windows is not for everyone, but there are cases where you would need to know a few of these basic CMD commands.

I’ve used computers from a time when Windows, as you know it today, didn’t exist. Yeap. I’m that old. Windows has evolved incredibly since, but under the hood, there’s still a lot of legacy code if you know where to look.

This is kept for legacy reasons, not because Microsoft doesn’t have the manpower to completely rewrite Windows. Companies still use old devices and programs, even if they run a newer version of Windows.

From all this legacy stuff, the CMD, short for Command Prompt, is among the oldest reminiscences. It actually predates Windows and comes from the text-only interface operating systems era, the good old MS-DOS.

It’s been upgraded in the past years with Power Shell, but it’s still present in its oldest form even in Windows 11. It’s not needed, most of the time, but it’s very useful for pulling info quickly, such as the computer serial number, for example. It can do a lot more, though.

This brings me to the next part:

Do You Ever Need to Use Command Prompt Commands?

For most people, the answer would be “No, you don’t need to know how to use CMD”. For power users, it is very useful. As any Linux aficionado will tell you, typing to get things done is way faster than clicking the mouse.

That’s true for Windows, Linux, and probably Mac OS.

For the rest of you, it’s probably something you would never need to worry about, unless… Well, if you overclock your PC you may need to repair the boot drive if Windows fails to load. Or if you dual-boot and at some point, you would like to erase all traces of the other OS.

The point is: if you need to use the Command Prompt it will probably be a very limited use case, but it can also be a moment when you really need to know your stuff in order to fix something that isn’t working. For those moments knowing the commands below could save the day.

So let’s get started. To launch the command prompt (cmd):

  1. Open the Start Menu (Win key)
  2. Type command prompt or cmd and press Enter.

Want to see even more methods to launch CMD?

This is what you’ll see: the Command Prompt window. You’ll see a flashing line (your cursor) and the currently selected folder. In Windows 11 it defaults to your current user documents folder.

command prompt cmd window

Change Directory (CD)

Files and folders are organized in Windows with what you would call a tree structure. Similar to a tree, there’s a root from which stem branches (directories or folders), smaller branches (sub-folders), and leaves (files). Each tree is like a disk drive or partition. The entire forest is your PC.

windows disk tree structure

The first command you would need to know is CD, short for change directory. Typing just cd won’t do anything. You need to add additional modifiers:

cd\

This will move you to the root of the current drive or partition.

command prompt cmd go to root of the drive
cd..

This will move to the parent folder (one step up). You can run consecutive commands to navigate one step up each time, until you reach the root.

command prompt cmd go to parent folder
cd [folder1\folder2]

This will navigate to the folder2 inside folder1, if this structure exists inside the current folder.

command prompt cmd go to specific folder

(1) You can type commands in uppercase, lowercase, or whatever combination you want. It makes no difference. (2) Always press Enter when you want to execute the command you just typed.

Change Drive (X:)

Now, most computers have more than one disk or partition, so you need to know how to break free from C: and roam free. You need to know the letter of an existing drive and then append a colon.

d:

This will move you to drive D.

command prompt cmd change current drive

From here you can issue the CD command to navigate further.

List Directory Contents (DIR)

Once inside a folder, you want you can use the following command to list its contents.

dir

This will show all files and folders, by name, type, creation date, and a summary count of all files and folders.

command prompt cmd list directory contents

You can also append a destination subfolder found somewhere inside the current folder to list its contents directly, without having to navigate to it in the first place.

Create a New Directory (MD or MKDIR)

If you want to create a new folder inside the current one you can use one of the following commands. Both work the same:

MD [folder_name]
MKDIR [folder_name]

This will create a folder with the specified name inside the current directory.

command prompt cmd create folder

Rename Files and Folders (REN)

Now, if you want to rename an existing folder you would use the following command:

REN [original_folder] [new_folder]

This will change the name of the specified folder. Use DIR to see the changes.

command prompt cmd rename directory

This command works for both files and folders. For the former, you would also need to specify the full filename, including its extension.

Copy Files (COPY)

Copying files (not folders) is done with the COPY command:

copy [original_file] [destination_folder]

This will copy the file with its contents inside the destination folder you’ve specified.

command prompt cmd copy file

You can also rename the new file by appending a new file name:

copy [original_file] [destination_folder\new_filename]

If you’re copying inside the same folder you don’t need to specify a destination folder, but a new filename is needed.

Delete Files and Folders (DEL, ERASE, and RD)

In the command prompt, there are two different commands for deleting files. These are DEL and Erase.

del [filename]
del [folder\filename]

This deletes the filename from the current folder (first line) or from the specified subfolder, relative to the current one (second line).

del [folder]

This will delete all files from the specified folder.

command prompt cmd delete files from folder

For deleting folders you need to use the RD command, short for Remove Directory.

rd [folder_name]

This will remove the specified subfolder, relative to the current one, pending confirmation. The command will also delete all the folder contents.

command prompt cmd delete folders including files

Some commands require confirmation during execution. You are usually asked to answer Yes/No/All, which can be done by pressing the y/n/a keys, followed by the Enter key.

Launch Executable Programs

Programs or apps are launched from what it’s called an executable file. It’s usually a file stored on the local disk which has the .exe extension. You can launch any program by calling its name, with or without the extension.

[appname]
[appname.extension]

Here’s how you launch the calculator app from inside the Windows\System32 folder found on the C: partition.

command prompt cmd launch programs and apps

Repair Missing or Corrupted System Files with System File Checker (SFC)

One very important utility included in Windows is the System File Checker, which is a tool that automatically checks and recovers missing or previously corrupted system files, something that can prevent Windows from starting.

Just run this command and let it get to 100%. The process is automatic and doesn’t need further user intervention.

sfc /scannow
windows recovery command prompt sfc scannow

Get Help Info (HELP and /?)

These are just the basic commands, without any modifiers. Yeap, you can add a ton of options to any command.

It’s next to impossible to remember all the options, so the help function comes to help you. You have three main options to call the help function:

help
help [command]
[command] /?

Other Command Prompt Commands and Keyboard Shortcuts

These are just the basic CMD commands, with no arguments, so as you can imagine, this article doesn’t even scratch the surface of what the Command Prompt can really do.

That being said, here are a few other things that might help you if you plan on digging deeper into CMD.

  • cls command: clear the screen contents (declutter the CMD window);
  • exit command: close the current Command Prompt window (terminates the CMD app);
  • TAB key: autocompletes the current word at the cursor in the file/folder path with a matching file or folder name (less typing).
  • UP key: shows the previously issued command, ready to execute again. Press UP consecutive times to navigate through all previous commands (less typing). Press the DOWN arrow key to navigate to the next command in the list.

Know any other important command prompt commands? Let me know in a comment below.

Also read:

Avatar for Ionuț-Alexandru Popa
I'm a writer and Editor-in-Chief at BinaryFork. I am passionate about technology, science, space exploration, and movies. I started writing about tech more than 20 years ago, after graduating in Computer Science.
Want to work smarter, not harder? Join our FREE Newsletter
Learn tricks you can use daily to save time. You will also receive a PDF with the essential Windows 11 keyboard shortcuts.
SIGN ME UP!
We want to hear what you have to say:

Your email address will not be published. Required fields are marked *

Our readers appreciate heated debates, as long as they remain polite, so they ask for your respect, even if you don't completely agree with them. Thanks!

The written content on our website is available free of charge because of the ads we're showing. Please support our efforts and deactivate your AdBlocker when you visit our site. Thank you!
Join our FREE Newsletter and learn computer tips you can use to do things faster
Every subscriber receives a PDF with the essential Windows 11 keyboard shortcuts.
I WANT TO JOIN!