)
AI Tool

How to Use Command Prompt: A Beginner’s Guide to Windows CMD

Command Prompt is a text window where you type commands and Windows runs them. You can open folders, copy files, check your internet connection and fix system problems without clicking through menus. This guide shows you how to open it, the commands you will use most, and how to avoid the mistakes that trip up beginners.

Short answer: Press the Windows key, type “cmd” and press Enter. Then type a command and press Enter to run it. Start with dir to list files, cd foldername to open a folder, cls to clear the screen and help to see a list of commands.

Best Terminal for Claude Code on Mac: Setup, Comparison and Tips

What Command Prompt Is

Command Prompt, also called CMD or cmd.exe, is a command-line tool built into Windows. Instead of clicking icons, you type short instructions. Windows reads each line, runs it and shows the result as text.

People use it because it is fast and precise. Renaming 200 files, checking why Wi-Fi is not working or repairing damaged system files can take seconds in CMD and many clicks without it. It is also a good first step toward scripting and IT work.

This guide is for Windows 10 and Windows 11. On a Mac or Linux computer, the equivalent tool is called Terminal and many commands are different.

How to Open Command Prompt

Use whichever method suits you.

  1. Start menu search. Press the Windows key, type cmd and press Enter.
  2. Run box. Press Windows key + R, type cmd and press Enter.
  3. Right-click the Start button (or press Windows key + X) and choose Terminal or Windows Terminal. On Windows 11 this may open PowerShell by default. Click the small down arrow next to the tab bar and choose Command Prompt.
  4. From a folder. Open the folder in File Explorer, click the address bar, type cmd and press Enter. CMD opens already pointed at that folder, which saves you from typing the path.
  5. Task Manager. Press Ctrl + Shift + Esc, choose File, then Run new task, type cmd and press Enter.

How to Open Command Prompt as Administrator

Some commands change system settings or repair Windows, and these need administrator rights.

  1. Press the Windows key and type cmd.
  2. Right-click Command Prompt in the results.
  3. Choose Run as administrator.
  4. Click Yes if Windows asks for permission.

The title bar will say “Administrator: Command Prompt”. Only use this mode when a command needs it.

Reading the Prompt

When CMD opens, you see something like this:

C:\Users\Rahim>

Here is what each part means:

  • C: is the drive you are on.
  • \Users\Rahim is the folder you are in, called the current directory.
  • > means CMD is waiting for you to type.

Every command you type works relative to this location unless you give the full path.

Basic Navigation Commands

These commands help you move around.

See what is in the current folder:
dir

You will see file names, sizes, dates and folders marked <DIR>. Useful options:

  • dir /a shows hidden files too
  • dir /s lists files in all sub-folders
  • dir /w shows a compact, wide list

Open a folder:
cd Documents

Go up one level:
cd ..

Go straight to the top of the drive:
cd \

Open a folder with spaces in its name. Use quotation marks:
cd "My Projects"

Switch to another drive. Type the drive letter and a colon:
D:

Or switch drive and folder together:
cd /d D:\Photos

Clear the screen:
cls

Show a list of commands:
help

See how one command works:
help dir or dir /?

Using /? after any command shows what it does and which options it takes. It is the quickest way to learn.

Working with Files and Folders

TaskCommandExample
Create a foldermkdir or mdmkdir Invoices
Create a nested foldermkdirmkdir Work\2026\October
Create a text file with contentechoecho Hello > note.txt
Show a text filetypetype note.txt
Copy a filecopycopy note.txt D:\Backup
Copy a whole folderxcopy /s /excopy Photos D:\Backup\Photos /s /e
Move a filemovemove note.txt Documents
Rename a filerenren note.txt report.txt
Delete a filedeldel report.txt
Delete an empty folderrmdirrmdir OldFolder
Delete a folder and everything in itrmdir /srmdir /s OldFolder
Show folder structuretreetree

Warning about deleting. del and rmdir /s do not send files to the Recycle Bin. They are gone. Always check the folder with dir before you delete, and read the path twice.

Tip: Press the Tab key while typing a file or folder name and CMD completes it for you. Press Tab again to cycle through matches. This saves typing and prevents spelling errors.

Network Commands

These help when your internet is slow or not working.

Show your IP address and network details:
ipconfig

For fuller information, including your MAC address and DNS servers:
ipconfig /all

Test whether you can reach a website or server:
ping google.com

Four replies with times in milliseconds mean the connection works. “Request timed out” means the reply did not arrive. Press Ctrl + C to stop a continuous ping started with ping -t google.com.

See the route your connection takes:
tracert google.com

Look up the address behind a domain name:
nslookup minciter.com

Clear the DNS cache. This helps when a website has moved or will not load:
ipconfig /flushdns

Refresh your IP address:
ipconfig /release
then
ipconfig /renew

See active connections:
netstat -an

Show the saved password of a Wi-Fi network you have used (needs administrator mode):
netsh wlan show profile name="NetworkName" key=clear

Look for “Key Content”. Use this only for your own networks.

A simple troubleshooting order for “no internet”: ping your router (its address is next to “Default Gateway” in ipconfig), then ping 8.8.8.8, then ping a domain name such as google.com. If the address works but the name does not, the problem is DNS. If the router does not answer, the problem is local.

System and Troubleshooting Commands

TaskCommandNotes
Show Windows versionverShort version line
Show detailed system infosysteminfoTakes a few seconds
Show your computer namehostname
Show your user namewhoami
List running programstasklist
Close a program by nametaskkill /IM notepad.exe /F/F forces it to close
Close a program by IDtaskkill /PID 1234 /FGet the ID from tasklist
Scan and repair system filessfc /scannowNeeds administrator mode and can take several minutes
Check a disk for errorschkdsk C:Add /f to fix errors, which may need a restart
Shut down nowshutdown /s /t 0
Restart nowshutdown /r /t 0
Cancel a scheduled shutdownshutdown /a
Show the date or timedate /t and time /t

Let sfc /scannow finish. Closing the window halfway can leave the scan incomplete.

Time-Saving Shortcuts

  • Up and down arrow keys bring back commands you typed before.
  • F7 shows a list of recent commands to pick from.
  • Tab completes file and folder names.
  • Ctrl + C stops a running command.
  • Ctrl + V or right-click pastes text. In current versions of Windows, Ctrl + C and Ctrl + V also work for copy and paste inside the window.
  • Drag a file or folder from File Explorer into the window to paste its full path.
  • Alt + Enter switches full-screen mode in the classic console window.
  • exit closes the window.

Redirection, Pipes and Wildcards

These three ideas turn single commands into powerful ones.

Redirection sends output to a file instead of the screen.
ipconfig /all > network.txt saves the result to network.txt. Use >> to add to the end of a file instead of replacing it.

Pipes send the output of one command into another.
tasklist | find "chrome" shows only the lines that contain “chrome”.

Wildcards match many files at once. The * stands for any characters and ? stands for one character.

  • dir *.jpg lists all JPG files
  • del *.tmp deletes all files ending in .tmp
  • copy *.docx D:\Backup copies all Word documents

Be careful with wildcards in delete commands. Run the same pattern with dir first to see exactly what will be affected.

Command Prompt Cheat Sheet

GoalCommand
List filesdir
Open a foldercd foldername
Go back one foldercd ..
Change driveD:
Clear screencls
Make a foldermkdir name
Copy a filecopy file destination
Rename a fileren old new
Delete a filedel filename
Show IP addressipconfig
Test connectionping address
List running programstasklist
Close a programtaskkill /IM name.exe /F
Repair system filessfc /scannow
Get help on a commandcommand /?
Close the windowexit

Common Errors and How to Fix Them

“is not recognized as an internal or external command.”
You mistyped the command, or the program is not installed or not on your system path. Check the spelling. Try command /? to confirm it exists.

“The system cannot find the path specified.”
The folder name is wrong or the folder is on another drive. Use dir to see what is in the current location. Use cd /d to change drives.

“Access is denied.”
You need administrator rights, or the file is in use. Reopen CMD as administrator, or close the program that is using the file.

“The syntax of the command is incorrect.”
A space or quotation mark is wrong. Put paths with spaces in quotation marks.

The command does nothing after you press Enter.
Some commands take time. Wait, or press Ctrl + C to stop it.

You changed to the wrong folder.
Type cd \ to go to the top of the drive, or cd %userprofile% to return to your user folder.

Staying Safe

Command Prompt does exactly what you type and rarely asks you to confirm. A few habits will protect your files.

  • Never run a command you found online if you do not understand it. Search the command name or add /? first.
  • Be extra careful with del, rmdir /s, format and diskpart, which can erase files or whole drives.
  • Do not run CMD as administrator unless a task requires it.
  • Back up important files before bulk changes.
  • Be suspicious of messages or websites that tell you to paste a command into CMD to “fix” something. Scammers use this trick to install malware.

Command Prompt vs PowerShell

Windows has two command-line tools. Command Prompt is older and simpler, and it is good for basic file work and network checks. PowerShell is newer, works with objects instead of plain text and is better for automation and system administration.

Most beginners can start with CMD. If you later want to manage many computers or write advanced scripts, learn PowerShell next. In Windows Terminal you can use both in separate tabs.

For official documentation, Microsoft lists every Windows command at https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands and explains the modern terminal app at https://learn.microsoft.com/en-us/windows/terminal/.

AI TOOLS

Frequently Asked Questions

How do I open Command Prompt on Windows 11?
Press the Windows key, type cmd and press Enter. You can also right-click Start and open Terminal, then choose Command Prompt from the tab menu.

How do I change directories in Command Prompt?
Use cd foldername to go into a folder, cd .. to go up one level and cd /d D:\Folder to switch to a folder on another drive.

How do I see all files in a folder?
Type dir. Add /a to include hidden files.

How do I copy and paste in Command Prompt?
In current Windows versions, use Ctrl + C and Ctrl + V. You can also right-click to paste.

How do I stop a command that is running?
Press Ctrl + C.

How do I run Command Prompt as administrator?
Search for cmd, right-click Command Prompt and choose Run as administrator.

What does cd .. do?
It moves you up one folder level.

How do I clear the screen?
Type cls and press Enter.

Can Command Prompt harm my computer?
It can if you run destructive commands or follow instructions from untrusted sources. Basic commands such as dir, cd, ipconfig and ping are safe.

Is Command Prompt the same on Mac?
No. On macOS and Linux you use Terminal, and commands such as ls and pwd replace dir and cd without arguments.

SY

Hi! I’m Suraiya — a writer, researcher, and Top Rated Freelancer on Upwork. I love writing and exploring the world of AI through my words. I’ve gained extensive professional experience through freelancing and have published research in peer-reviewed journals. I also write fiction, nonfiction, and romantic books. Since this is the AI era, I’m excited to explore this world too — let’s learn together!

Related Articles

Back to top button