How to use CMD in Windows

Command Prompt, often referred to as CMD, is a built-in command-line tool that allows users to interact with Windows using text-based commands. While most Windows tasks can be completed through menus and graphical settings, CMD provides a faster way to perform certain actions, troubleshoot problems, manage files, and access system information. Whether you're a beginner or someone looking to expand your Windows knowledge, learning how to use CMD can help you work more efficiently and gain greater control over your device.

This guide explains how to open Command Prompt, navigate the file system, run common commands, and use CMD for basic troubleshooting.

What is Command Prompt?

Command Prompt is a command-line interpreter included with Windows operating systems. Instead of clicking through windows and menus, users enter commands directly into a text interface.

CMD can be used to:

  • Navigate files and folders.
  • Launch programs.
  • Manage files.
  • View system information.
  • Troubleshoot network problems.
  • Run administrative tasks.
  • Execute scripts and automation tasks.

Many IT professionals use Command Prompt regularly because it provides direct access to system functions.

How to open Command Prompt

There are several ways to launch CMD in Windows.

Method 1: Use Windows Search

  1. Open the Start menu.
  2. Type: cmd
  3. Select Command Prompt from the search results.

Method 2: Use the Run dialog

  1. Press Windows + R.
  2. Type: cmd
  3. Press Enter.

The Command Prompt window will open immediately.

Method 3: Open CMD as administrator

Some commands require elevated permissions.

  1. Search for Command Prompt.
  2. Right-click the application.
  3. Select Run as administrator.

This provides access to administrative commands that cannot be executed from a standard user session.

Understanding the CMD window

When Command Prompt opens, you'll usually see something similar to: C:\Users\Username>

This indicates your current location within the Windows file system. Every command you enter will run from this location unless you navigate to another directory. Understanding your current location is important when managing files and folders through CMD.

How to navigate folders

File navigation is one of the most common uses of Command Prompt.

View your current location

Type: cd and press Enter. CMD will display your current directory.

Open a folder

To move into a folder, type: cd Documents and press Enter. Replace "Documents" with the folder you want to open.

Move back one level

Type: cd .. and press Enter.

This takes you back to the parent folder.

Go to the root drive

Type: cd \ and press Enter.

This returns you to the top level of the current drive. Learning the CD command is one of the most important CMD skills because many commands depend on your current directory.

How to view files and folders

To display the contents of the current folder, type: dir and press Enter.

This command shows:

  • Files
  • Folders
  • File sizes
  • Creation and modification dates

It's often the first command users run after navigating to a directory.

How to create folders

Creating directories through CMD is straightforward.

Type: mkdir NewFolder and press Enter. A folder named "NewFolder" will be created in the current location. You can replace "NewFolder" with any folder name you prefer.

How to delete folders

To remove a folder, type: rmdir FolderName and press Enter.

Be careful when deleting folders because the action cannot always be undone.

Always verify the folder contents before removing directories.

How to manage files

Command Prompt includes several commands for working with files.

Copy files

Type: copy file.txt D:\Backup and press Enter.

This copies the file to another location.

Move files

Type: move file.txt D:\Documents and press Enter.

This moves the file to a different folder.

Delete files

Type: del file.txt and press Enter.

Always double-check file names before deleting them.

Useful CMD commands for Windows

Several commands are especially useful for everyday tasks and troubleshooting.

Check your IP address

Type: ipconfig

This displays information about your network connections and IP addresses.

Test internet connectivity

Type: ping google.com

This checks whether your device can communicate with a website or network resource.

View system information

Type: systeminfo

This command displays information about your Windows installation, hardware, memory, and system configuration.

Clear the DNS cache

Type: ipconfig /flushdns

This can sometimes resolve website connectivity issues by clearing stored DNS records.

Launch applications from CMD

You can open Windows applications directly through Command Prompt.

For example: notepad opens Microsoft Notepad.

calc opens Calculator.

taskmgr opens Task Manager.

This can be a quick way to launch commonly used tools without navigating through menus.

Using CMD for troubleshooting

Command Prompt includes several powerful troubleshooting tools.

Check system files

Type: sfc /scannow

Windows will scan important system files and attempt to repair any issues it finds.

Check a drive for errors

Type: chkdsk

This command checks storage drives for file system problems.

Trace network connections

Type: tracert google.com

This displays the route network traffic takes to reach a destination. These commands can help diagnose common Windows and network issues.

CMD vs PowerShell

Modern Windows versions include both Command Prompt and PowerShell.

Command Prompt is generally:

  • Easier for beginners.
  • Focused on traditional Windows commands.
  • Suitable for basic administration and troubleshooting.

PowerShell is generally:

  • More advanced.
  • Better for automation.
  • Designed for scripting and system management.

For users who are just learning command-line tools, CMD is often the best place to start.

Best practices when using CMD

To use Command Prompt safely:

  • Verify commands before running them.
  • Use administrator mode only when necessary.
  • Back up important files before making major changes.
  • Be cautious when using delete commands.
  • Learn what a command does before executing it.

These habits can help prevent accidental changes and improve system stability.