- 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. This brings me to the next part:
- 1 Do You Ever Need to Use Command Prompt Commands?
- 2 Change Directory (CD)
- 3 Change Drive (X:)
- 4 List Directory Contents (DIR)
- 5 Create a New Directory (MD or MKDIR)
- 6 Rename Files and Folders (REN)
- 7 Copy Files (COPY)
- 8 Delete Files and Folders (DEL, ERASE, and RD)
- 9 Launch Executable Programs
- 10 Repair Missing or Corrupted System Files with System File Checker (SFC)
- 11 Get Help Info (HELP and /?)
- 12 Other Command Prompt Commands and Keyboard Shortcuts
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 both 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):
- Open the Start Menu (Win key)
- 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.
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.
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:
This will move you to the root of the current drive or partition.
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.
This will navigate to the folder2 inside folder1, if this structure exists inside the current 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.
This will move you to drive D.
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.
This will show all files and folders, by name, type, creation date, and a summary count of all files and folders.
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.
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.
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.
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).
This will delete all files from the specified folder.
For deleting folders you need to use the RD command, short for Remove Directory.
This will remove the specified subfolder, relative to the current one, pending confirmation. The command will also delete all the folder contents.
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.
Here’s how you launch the calculator app from inside the Windows\System32 folder found on the C: partition.
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.
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 DOWN to navigate the next command in the list.
Know any other important command prompt commands? Let me know in a comment below.