PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteCommand Prompt is Windows’ text-based command interpreter, cmd.exe. It can launch programs, navigate folders, manage files, inspect network settings, run batch scripts, and help with troubleshooting. This guide covers commands available in Windows 10 and Windows 11; type paths and switches carefully, especially before commands that delete or overwrite data.
Command Prompt, cmd.exe, and Windows Terminal
Command Prompt is the shell, and its executable file is cmd.exe. Windows Terminal is a host application that can display Command Prompt, PowerShell, Windows Subsystem for Linux, and other shells.
Windows 11 did not remove Command Prompt or replace it with PowerShell. On Windows 11 version 22H2 and later, Command Prompt may open inside Windows Terminal instead of the older Windows Console Host.
How to open Command Prompt
- Select Search on the taskbar.
- Type Command Prompt or cmd.
- Select Command Prompt from the results.
To open an elevated session for tasks that need administrator permissions:
#1 Best Overall
- Search for Command Prompt.
- Select Run as administrator.
- Approve the User Account Control prompt, or enter administrator credentials if requested.
An elevated window usually shows Administrator: Command Prompt in its title bar. A normal window does not gain administrator rights merely because your account belongs to the Administrators group.
Changing the terminal host in Windows 11
In Settings, select System > Advanced. Under Terminal, select Windows Console Host. Alternatively, open Windows Terminal settings, select Startup, and change Default terminal application.
Understanding the prompt
A prompt may look like C:\Users\Alex>. It shows the active drive and current directory. Type a command after the > symbol and press Enter.
The current directory affects relative paths. The command dir lists the current folder; dir C:\Windows lists C:\Windows regardless of the current location.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsMost built-in commands provide help with the /? switch. For example: dir /?, cd /?, and copy /?. Running cmd without parameters displays operating-system version and copyright information. Options include /c to run a command and exit, /k to run a command and remain open, and /d to disable commands configured through Command Processor AutoRun registry entries.
Move around folders and drives
Check and change the current directory
| Command | Purpose |
|---|---|
| cd | Display the current drive and directory |
| cd .. | Move to the parent directory |
| cd \ | Move to the root of the current drive |
| cd path | Change to a directory |
| cd /d D:\Projects | Change both the drive and directory |
To switch to drive D and its Projects folder, use cd /d D:\Projects, or type D: and then change directories. cd and chdir are equivalent.
Absolute and relative paths
An absolute path starts from a drive root, such as C:\Users\Alex\Documents. A network UNC path is also absolute, for example \\server\share\folder.
Relative paths are calculated from the current directory. Examples include Documents and ..\Pictures. A path beginning with a backslash, such as \Windows, starts at the root of the current drive.
Recommended Free Tools
Put quotation marks around paths containing spaces: cd “C:\Program Files” or dir “C:\Users\Alex\My Documents”. Without quotes, Command Prompt can treat words after a space as separate arguments.
Rank #2
Temporarily save your location
pushd C:\Projects saves the current directory and changes to another one. Use popd to return to the saved location. With command extensions enabled, pushd can accept a network path and temporarily assign it an unused drive letter; popd removes that mapping.
List and manage files
List files with dir
Use dir to list files in the current folder.
| Command | Result |
|---|---|
| dir /p | Pause after each screen |
| dir /w | Use a wide listing |
| dir /a | Include files with hidden and system attributes |
| dir /s | Include subdirectories |
| dir /b | Show names only in bare format |
You can specify a folder or filename pattern, such as dir C:\Windows, dir *.txt, or dir report?.txt.
Create folders
Use mkdir, or its alias md. For example: mkdir C:\Work\Reports. With the default command extensions enabled, one command can create intermediate folders, such as mkdir C:\Work\Reports\2026.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Copy files
Use copy for ordinary files: copy report.txt backup.txt or copy “C:\Work\Report.txt” “D:\Backup\Report.txt”.
For directory trees, xcopy supports subdirectories. Example: xcopy C:\Work D:\Backup /s.
- /s copies subdirectories but not empty ones.
- /e copies all subdirectories, including empty ones.
- /i treats the destination as a directory in common directory and wildcard cases.
- /y suppresses overwrite prompts.
- /l lists what would be copied without copying it.
- /z enables restartable copying over a network.
Use /l first when you want to verify an xcopy operation.
Move and rename
Use move report.txt C:\Archive\ to move a file. The /y switch suppresses an overwrite prompt; /-y enables prompting.
ren, also called rename, changes a name within the current directory. For example: ren draft.txt final.txt. It cannot specify a new drive or destination path; use move to place a file elsewhere.
Delete files and folders
del deletes files, for example del report.txt, del “C:\Work\Old Report.txt”, or del *.tmp. It does not delete directories, and files removed with del generally cannot be recovered through the Recycle Bin.
Before using a wildcard, preview its target with the same pattern, such as dir *.tmp before del *.tmp.
Use rmdir or its alias rd to delete a directory. A non-empty directory requires /s: rmdir /s C:\Work\OldReports. Adding /q suppresses confirmation: rmdir /s /q C:\Work\OldReports. This removes the complete directory tree without confirmation or Recycle Bin recovery. Treat /s /q as high risk. rmdir cannot delete the directory you are currently inside; change elsewhere first.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Wildcards
The main filename wildcards are * (a sequence of characters) and ? (one character in a filename pattern). Examples: dir *.txt, dir report?.txt, and del C:\Temp\*.log. Because wildcards can match many files, run dir with the same pattern before using del, move, or another command that changes data.
Environment variables with set
Use set to list variables, or set USER to show variables whose names begin with USER. Create and use a temporary variable with set NAME=Alex and echo %NAME%; delete it with set NAME=.
Do not put a space before the equals sign. set NAME =Alex creates a variable named NAME with a trailing space. To include special characters, escape them with a caret, as in set NAME=New^&Name, or use quotes: set NAME=”New&Name”. In the quoted form, the quotation marks become part of the value.
set changes the environment of the current Command Prompt process and programs launched from it. It does not permanently change user or system variables. Permanent changes can be made through Windows environment-variable settings; system-variable changes generally require administrator privileges.
Chain commands, redirect output, and pipe results
| Syntax | Behavior |
|---|---|
| command1 & command2 | Run both commands regardless of the first result |
| command1 && command2 | Run the second only if the first succeeds |
| command1 || command2 | Run the second only if the first fails |
For example, mkdir Reports && cd Reports creates a folder and enters it if creation succeeds.
Save command output to a file with >, such as dir > files.txt. If files.txt exists, this replaces its contents. A pipe sends output to another command: dir | more. The caret escapes characters Command Prompt would otherwise interpret: echo A^&B. Quotation marks are usually better for paths containing spaces.
Read and search text files
Use type notes.txt to display a text file, or type notes.txt | more for a long file. type is intended for text; using it on a binary file can produce unreadable output.
Use findstr to search text, for example findstr /i “error” app.log or findstr /s /i “password” *.txt.
- /i ignores case.
- /s searches the current directory and its subdirectories.
- /l treats the search text literally.
- /r uses regular-expression matching, which is the default mode.
- /n shows matching line numbers.
- /m shows only filenames containing a match.
Place options before the search strings and filenames.
Useful troubleshooting commands
Inspect network settings
Use ipconfig or ipconfig /all to inspect network settings. For common connection troubleshooting, Windows also provides ipconfig /release, ipconfig /renew, and ipconfig /flushdns. Releasing and renewing applies to DHCP connections. Flushing DNS clears the local resolver cache; it does not fix every DNS or internet problem.
Test reachability
Use ping example.com to test whether a host responds to an ICMP echo request. A failed ping does not prove the target is offline; firewalls and network policies may block ICMP.
List running processes
Use tasklist to display processes. Output options include tasklist /fo table, tasklist /fo list, and tasklist /fo csv. To filter by image name, use tasklist /fi “IMAGENAME eq notepad.exe”.
Batch files
A batch file is a text file containing Command Prompt commands, normally saved with a .bat or .cmd extension. Run one by entering its filename or path, such as backup.bat.
A common first line is @echo off. echo off hides commands as they execute; @ hides that particular line.
Batch files receive arguments through numbered parameters. %1 and %2 contain the first and second arguments, and %0 represents the batch-file name. For example, a file containing @echo off, echo Source: %1, and echo Destination: %2 could be run as showpaths.bat C:\Work D:\Backup.
Interactive for loops versus batch files
At an interactive prompt, use one percent sign: for %f in (*.txt) do @echo %f. Inside a batch file, use two: for %%f in (*.txt) do echo %%f. Using the wrong form is a frequent reason a loop works at the prompt but fails in a .bat file.
Free tools Windows power users keep installed
One-click scans. No signup required.
Best Value
Command Prompt limits
Command Prompt can process a maximum command-line string of 8,191 characters. The limit also applies after environment variables are expanded and to command lines processed from batch files.
Microsoft documents an individual environment-variable limit of 8,192 bytes and a maximum environment-block size of 65,536 characters. A command can exceed the limit after a variable expands. Shortening paths, reducing oversized variables, or placing parameters in a file can help.
Safe habits for beginners
- Run command /? before using an unfamiliar switch.
- Use absolute paths when the target matters.
- Quote paths containing spaces.
- Preview wildcard matches with dir.
- Do not add /q to a destructive command until you have verified the target.
- Remember that del and rmdir /s /q do not provide normal Recycle Bin recovery.
- Use an elevated window only when the task requires it.
- Check whether you are in Command Prompt or PowerShell. Similar-looking commands can have different syntax; for example, type is a Command Prompt command but an alias for Get-Content in PowerShell.
Further Microsoft documentation
FAQ
Is Command Prompt the same as Windows Terminal?
No. Command Prompt is the cmd.exe shell. Windows Terminal is an application that hosts Command Prompt and other command-line shells.
Did Windows 11 replace Command Prompt with PowerShell?
No. Command Prompt remains available in Windows 10 and Windows 11. PowerShell is a separate shell with different commands and syntax.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Why did cd D:\Folder not switch to drive D?
Use cd /d D:\Folder, or type D: first and then change directories. Without /d, cd can change the stored directory for another drive without making that drive active.
Can del delete folders?
No. del deletes files. Use rmdir or rd for directories; a non-empty directory requires rmdir /s.
Does ren move a file?
No. ren changes a file or directory name within its existing location. Use move to place it in another directory or drive.
Does set permanently change the PATH?
No. set changes variables only in the current Command Prompt process and programs launched from it. Permanent user or system variables must be changed through Windows environment-variable settings or an appropriate administrative tool.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsWhat does rmdir /s /q do?
It deletes a directory and its complete contents without asking for confirmation. It is destructive and does not move files to the Recycle Bin.
The Bottom Line
Start with dir, cd, mkdir, copy, and type until paths and the current directory feel familiar. Then add variables, redirection, batch files, and troubleshooting commands. Inspect the path and wildcard match before running del or rmdir /s /q.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

