15 Basic CMD Commands to Know on Windows

The Windows Command Prompt, also known as CMD, is not just a tool reserved for computer enthusiasts. Behind its austere appearance lies a powerful tool capable of performing numerous tasks on Windows.

As we mentioned in our previous article, CMD allows you to run system diagnostic and repair tools such as DISM, SFC, or CHKDSK, manage network configurations, and much more. But that’s just a glimpse of the possibilities this tool offers.

Beyond these advanced commands, CMD contains many other practical features. File and folder management, task automation, troubleshooting — all these operations can be done with just a few keystrokes.

In this article, we will reveal 15 lesser-known commands that can be useful on Windows. But before we dive in, an important reminder: all these commands require you to know how to open the Command Prompt. If you’re unsure how to proceed, feel free to check out our dedicated article “How to Open the Command Prompt in Windows,” which explains everything from A to Z.

1. CD: Change Directory

The CD (Change Directory) command allows you to navigate through folder structures:

  • To go to the root of the drive, type:
  • CD\
  • To go to a specific folder, specify the path:
  • CD C:\Windows\System32
  • To move up one folder level, use:
  • CD..
  • To go directly to a user folder like Documents, type:
  • CD /d %userprofile%\Documents

2. DIR: List Folder Contents

With the DIR command, you can display the contents of the current folder, along with the size and modification date of each item:

  • DIR

Tip: The TREE command provides a more visual display in the form of a directory tree.

3. CLS: Clear the Screen

To clear the console, nothing beats the CLS (Clear Screen) command:

  • CLS

The screen is instantly cleaned, ready for new commands.

4. MKDIR or MD: Create a New Folder

These two commands are equivalent for creating a new directory in the current location:

  • MKDIR MyNewFolder

You can also create an entire hierarchy of subfolders in one go:

  • MKDIR Folder\Subfolder1\Subfolder2

5. COPY: Copy Files

To copy a file, specify its name and destination path:

  • COPY C:\document.txt D:\Folder\document_copy.txt

If you’re staying in the same folder, there’s no need to specify the path, just the new name:

  • COPY document.txt document_copy.txt

6. XCOPY: Copy Folders

If you want to copy a folder along with all its contents, use XCOPY instead:

  • XCOPY /s /i C:\MyFolder D:\Destination
  • /s copies all subfolders, even empty ones, and /i creates the destination if it doesn’t exist.

7. REN: Rename a File or Folder

Use the REN command to easily rename an item:

  • REN "Untitled.png" "Photo.png"

To rename a folder, follow the same process.

8. DEL: Delete Files

The DEL command permanently deletes files, so be cautious!

To delete a specific file:

  • DEL document.txt

To delete all files with a specific extension:

  • DEL *.tmp

To delete absolutely all files in the folder:

  • DEL *.*

9. RD: Delete an Empty Folder

To remove a folder, use RD (Remove Directory):

  • RD BadFolder

Be careful: the folder must be empty! Otherwise, delete the files first with DEL.

10. HELP: Get Help

Type HELP to display a list of all available commands.

To get more information about a specific command, use HELP followed by the command name, or add /? after the command. For example:

  • HELP XCOPY
  • XCOPY /?

11. Use the Tab Key for Auto-Complete

When typing a folder path or file name, you can use the Tab key instead of typing everything manually.

The name will be automatically completed. If there are several options, press Tab multiple times to scroll through them.

This is very handy for speeding up work and avoiding typos!

12. Launch an Application

You can also launch an application from the command line. Just type the name of its executable file, for example:

  • notepad.exe

If the application isn’t in the current directory, specify the full path:

  • C:\Windows\notepad.exe

Press the Up Arrow key to retrieve the last commands you typed, which is quicker than rewriting them!

By pressing F7, a popup window will show your command history. Use the arrow keys to select one.

You can also do a quick search using Ctrl+R. Start typing the beginning of a command, then press Enter when it’s found.

14. Change Drive

To switch to another drive, simply type the letter followed by a colon. For example, to switch to drive D:

  • D:

To change both the drive and folder at the same time, combine it with CD:

  • CD /d D:\Music

15. Naming Rules

In Windows, certain folder and file names are forbidden: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9.

Additionally, names must not contain the following characters: \ / : * ? ” < > |

If you have a name with spaces, make sure to enclose it in quotes:

  • CD "C:\Program Files"

In Summary

Now, you know the main commands to effectively use the Windows Command Prompt. Don’t hesitate to try them out — practice is the best way to memorize them.

With a bit of habit, you’ll save a lot of time by performing your tasks directly from the command line rather than using the mouse. And if you ever get stuck, remember to use the HELP command!

Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1751

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

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