How to Use the Windows Command Prompt: Essential Commands and Troubleshooting Guide
Summary: Learn how to open the Windows Command Prompt, run essential troubleshooting commands, repair startup issues, and fix network problems on your Dell computer.
Instructions
Table of Contents
- What Is the Command Prompt?
- Command Prompt vs. PowerShell vs. Windows Terminal
- How to Open the Command Prompt
- How to Open the Command Prompt as an Administrator (Elevated)
- How to Open the Command Prompt from the Recovery Environment
- How to Open the Command Prompt in Safe Mode
- Essential Commands for Troubleshooting Your Dell Computer
- Networking Commands
- File and Folder Management Commands
- Commonly Used Commands Quick Reference
- Wildcards, Operators, and Output Redirection
- Customizing the Command Prompt
- Helpful Keyboard Shortcuts
- Frequently Asked Questions
1. What Is the Command Prompt?
The Command Prompt is a built-in tool in Windows that lets you communicate with your computer by typing text-based commands. Instead of clicking through menus and icons, you type specific instructions and press Enter to carry them out.
You might think of it as a direct conversation with your operating system. While the Windows desktop gives you a visual way to interact with your computer, the Command Prompt gives you a text-based way to do the same things — and often more.
When would you use the Command Prompt?
The Command Prompt is especially useful when you need to:
- Troubleshoot problems — Run diagnostic tools to fix startup issues, repair corrupted system files, or resolve network connectivity problems.
- Perform tasks quickly — Rename many files at once, check your IP address, or gather system information in seconds.
- Access advanced tools — Some Windows repair and diagnostic utilities are only available through the Command Prompt.
- Recover a system that will not boot — When Windows cannot start normally, you can access the Command Prompt from the recovery environment to run repair commands.
- Follow technical support instructions — Dell support agents and online guides often ask you to run specific commands to diagnose or resolve issues.
Good to know: You do not need to be a technical expert to use the Command Prompt. As long as you follow the instructions carefully and type the commands exactly as shown, you can use it confidently.
2. Command Prompt vs. PowerShell vs. Windows Terminal
Windows includes more than one command-line tool. Here is a quick comparison to help you understand the differences.
|
Feature |
Command Prompt |
Windows PowerShell |
Windows Terminal |
|---|---|---|---|
|
What it is |
The classic text-based command tool included in Windows since the early days. |
A more advanced command-line tool with additional capabilities for automation and scripting. |
A modern app that lets you open Command Prompt, PowerShell, and other command-line tools in tabs within a single window. |
|
Best for |
Basic troubleshooting, file management, and network commands. |
Advanced system administration and automation tasks. |
Using multiple command-line tools side by side. |
|
How to identify it |
Title bar reads "Command Prompt" or "cmd.exe". |
Title bar reads "Windows PowerShell". |
Title bar reads "Terminal" with tabbed interface. |
Good to know: When you right-click the Start button, you may see Terminal instead of Command Prompt. You can still use Command Prompt inside Windows Terminal or open it separately using the methods described below.
3. How to Open the Command Prompt
Below are several ways to open the Command Prompt on your Dell computer. Choose the method that works best for you.
Method 1: Use the Search bar
- Select the Search icon on the taskbar (or press the Windows key).
- Type cmd or Command Prompt.
- Select Command Prompt from the search results.
Method 2: Use the Run dialog box
- Press the Windows key + R to open the Run dialog box.
- Type cmd and then select OK (or press Enter).
Method 3: Use Windows Terminal
- Right-click the Start button (or press the Windows key + X).
- Select Terminal.
- In the Terminal window, select the down arrow (˅) next to the tab bar and then select Command Prompt.
Method 4: Use File Explorer
- Open File Explorer.
- Select the address bar at the top of the window.
- Type cmd and then press Enter.
- A Command Prompt window opens, set to the folder you were viewing in File Explorer.
4. How to Open the Command Prompt as an Administrator (Elevated)
Some commands require administrator privileges to run. This is called an "elevated" Command Prompt. When you see instructions that say "open an elevated Command Prompt" or "run as administrator," follow the steps below.
Method 1: Use the Search bar (recommended)
- Select the Search icon on the taskbar (or press the Windows key).
- Type cmd or Command Prompt.
- Right-click Command Prompt in the search results and then select Run as administrator.
- If the User Account Control (UAC) prompt appears, select Yes.
Method 2: Use the Run dialog box
- Press the Windows key + R to open the Run dialog box.
- Type cmd.
- Press Ctrl + Shift + Enter (instead of selecting OK).
- If the User Account Control (UAC) prompt appears, select Yes.
Method 3: Use Windows Terminal
- Right-click the Start button (or press the Windows key + X).
- Select Terminal (Admin).
- If the User Account Control (UAC) prompt appears, select Yes.
- In the Terminal window, select the down arrow (˅) next to the tab bar and then select Command Prompt.
How to verify you have an elevated Command Prompt: Look at the title bar of the Command Prompt window. If it reads Administrator: Command Prompt (or Administrator: C:\Windows\System32\cmd.exe), you are running with administrator privileges. If it reads only Command Prompt, you have a standard (non-elevated) session.
5. How to Open the Command Prompt from the Recovery Environment
If your Dell computer cannot start Windows normally, you can access the Command Prompt from the Windows Recovery Environment (WinRE). This is essential for running boot repair commands, checking disk health, or repairing system files when Windows is unresponsive.
Method 1: From the Advanced Startup menu (if Windows can partially start)
- Open Settings (press the Windows key + I).
- Select System, then select Recovery.
- Next to Advanced startup, select Restart now.
- When your computer restarts, select Troubleshoot.
- Select Advanced options.
- Select Command Prompt.
- If prompted, select your user account and enter your password.
Method 2: From a failed boot (if Windows will not start)
- Power on your Dell computer.
- When Windows fails to start, it may automatically display the Recovery screen after two or three failed attempts. If it does not, try this:
- Press and hold the power button for 10 seconds to force a shutdown.
- Power on the computer again.
- As soon as Windows begins to load (you see the spinning dots or Dell logo), press and hold the power button for 10 seconds again.
- Repeat this process two to three times. On the next start, Windows should enter the Recovery Environment.
- Select Troubleshoot.
- Select Advanced options.
- Select Command Prompt.
- If prompted, select your user account and enter your password.
Method 3: From a Windows installation USB drive
This method works if the USB drive was created using the Microsoft Media Creation Tool (standard Windows installation/setup media). It does not work with a USB drive created using the Dell OS Recovery Tool. The Dell OS Recovery Tool is built for SupportAssist OS Recovery instead — it scans hardware, repairs Windows, resets Windows, and backs up data, rather than launching the standard Windows Setup screen shown below.
- Insert a Windows installation USB drive into your Dell computer.
- Power on (or restart) the computer.
- Press F12 at the Dell logo to open the one-time boot menu.
- Select the USB drive from the list.
- When the Windows Setup screen appears, select your language preferences and then select Next.
- Select Repair your computer (in the lower-left corner).
- Select Troubleshoot.
- Select Command Prompt.
Good to know: In the Recovery Environment, the drive letter assigned to your Windows installation may not be C:. To find the correct drive letter, type bcdedit or check each drive using dir C:, dir D:, dir E: until you find the one containing the Windows folder.
6. How to Open the Command Prompt in Safe Mode
Safe Mode starts Windows with a minimal set of drivers and services. If you need to troubleshoot an issue that only occurs during normal operation, you can open the Command Prompt in Safe Mode.
- Open Settings (press the Windows key + I).
- Select System, then select Recovery.
- Next to Advanced startup, select Restart now.
- When your computer restarts, select Troubleshoot.
- Select Advanced options.
- Select Startup Settings, then select Restart.
- After the computer restarts, press 6 or F6 to select Enable Safe Mode with Command Prompt.
- Sign in with your account. The Command Prompt opens automatically.
Stuck in Safe Mode? If the computer keeps starting into Safe Mode automatically — for example, after a previous troubleshooting session set it that way — open an elevated Command Prompt (or the Command Prompt from the Recovery Environment) and type: bcdedit /deletevalue {default} safeboot, then restart. If you have desktop access, you can also clear this by opening System Configuration (type msconfig in the Search bar), selecting the Boot tab, and clearing the Safe boot checkbox.
7. Essential Commands for Troubleshooting Your Dell Computer
These are the commands Dell Support most commonly recommends to diagnose and fix problems. Each command includes a description, example, and guidance on when you might need it.
sfc /scannow (Admin)
The System File Checker (SFC) scans all protected Windows system files and replaces corrupted or missing files with a known good copy.
When to use it: Your computer is behaving unexpectedly, applications crash frequently, or you receive system errors.
How to use it:
- Open an elevated Command Prompt.
- Type the following command and then press Enter: sfc /scannow
- Wait for the scan to complete. This typically takes 10 to 15 minutes.
- Review the results:
-
- "Windows Resource Protection did not find any integrity violations." — No problems were found.
- "Windows Resource Protection found corrupt files and successfully repaired them." — Problems were found and fixed.
- "Windows Resource Protection found corrupt files but was unable to fix some of them." — Try running the DISM command below first, then run sfc /scannow again.
Good to know: The command above only works from within a fully loaded Windows session. If you are running sfc from the Windows Recovery Environment or a Windows installation USB (see Section 5), the system you are repairing is offline, so you must tell SFC where it is: sfc /scannow /offbootdir=C:\ /offwindir=C:\Windows (adjust the drive letter to match your Windows installation). Running sfc /scannow with no switches from the Recovery Environment will fail because there is no running OS instance for it to check.
DISM /RestoreHealth (Admin)
The Deployment Image Servicing and Management (DISM) tool repairs the Windows system image. If SFC cannot fix corrupted files, DISM can repair the underlying image that SFC relies on.
When to use it: The sfc /scannow command reported it could not fix some corrupted files, or you want to ensure the system image is healthy before running SFC.
How to use it:
- Open an elevated Command Prompt.
- Type the following command and then press Enter: DISM /Online /Cleanup-Image /RestoreHealth
- Wait for the process to complete. This can take 15 to 30 minutes depending on your system. Do not close the window.
- After DISM finishes, run sfc /scannow again to verify the repairs.
Good to know: The /Online switch tells DISM to repair the operating system you are currently running, and it requires an internet connection to reach Windows Update (or a Group Policy–managed alternate source) unless you supply /Source. If you are repairing an offline installation from the Recovery Environment, replace /Online with /Image:C:\ (pointing to the drive letter of the offline Windows installation), for example: DISM /Image:C:\ /Cleanup-Image /RestoreHealth
Tip: If DISM fails because your internet connection is unavailable, you can use a Windows installation USB as the repair source: DISM /Online /Cleanup-Image /RestoreHealth /Source:D:\Sources\install.wim
Replace D: with the drive letter of your USB drive.
chkdsk (Admin)
Check Disk (chkdsk) examines your hard drive or solid-state drive (SSD) for file system errors, bad sectors, and other disk issues.
When to use it: Your computer runs slowly, files are missing or corrupted, you see disk-related errors, or you suspect drive problems.
How to use it:
- Open an elevated Command Prompt.
- Type the following command and then press Enter: chkdsk C: /f /r
- C: — The drive letter to check. Replace with another letter if needed.
- /f — Fixes errors found on the disk.
- /r — Locates bad sectors and recovers readable information (includes /f functionality).
- If you check the drive where Windows is installed (typically C:), you are prompted to schedule the scan for the next restart. Type Y and then press Enter. Restart your computer to begin the scan.
Boot Repair Commands (Admin — Recovery Environment)
What they do: These commands repair the boot configuration and startup files that Windows needs to load. They are most useful when run from the Recovery Environment Command Prompt (see Section 5).
When to use them: Your computer does not start Windows, displays a "Boot Device Not Found" or "Operating System Not Found" error, or goes to the Recovery screen automatically.
Commands to run (in order):
- Open the Command Prompt from the Recovery Environment.
- Type each of the following commands one at a time, pressing Enter after each:
-
- bootrec /fixmbr — Repairs the Master Boot Record.
- bootrec /fixboot — Writes a new boot sector.
- bootrec /scanos — Scans all disks for Windows installations.
- bootrec /rebuildbcd — Rebuilds the Boot Configuration Data store.
- If bootrec /rebuildbcd finds a Windows installation and prompts you to add it to the boot list, type Y and press Enter.
- Type exit and press Enter, then restart your computer.
Viewing and editing boot configuration:
|
Command |
What it does |
|---|---|
|
bcdedit |
Lists all entries in the current Boot Configuration Data (BCD) store (equivalent to bcdedit /enum ACTIVE). Requires an elevated Command Prompt. |
|
bcdedit /enum all |
Lists every entry in the BCD store, including firmware and inherited entries, not just the active boot menu. |
|
bcdedit /export C:\BCD_Backup |
Saves a complete copy of the current BCD store to a file. Run this before making any changes, so you can restore the original configuration with bcdedit /import if something goes wrong. |
|
bcdedit /timeout 30 |
Sets how many seconds the boot menu waits before starting the default entry. Useful on Dell systems configured to dual-boot two operating systems. |
|
bcdedit /default {ntldr} |
Sets which boot entry starts automatically when the timeout expires. Replace {ntldr} with the identifier shown by bcdedit /enum for the entry you want. |
|
bcdedit /set {default} bootstatuspolicy ignoreallfailures |
Tells Windows to attempt a normal boot even after a failure, instead of automatically dropping into the Recovery Environment. Dell Support may recommend this when a system is caught in a repair loop. |
|
bcdedit /deletevalue {default} safeboot |
Removes a Safe Mode boot flag, returning the computer to a normal startup. Use this if a system was configured (via msconfig or bcdedit /set) to always boot into Safe Mode and you need it to start normally again — see Section 6. |
diskpart (Admin)
DiskPart is a command-line disk management tool that lets you view, create, delete, format, and resize disk partitions.
When to use it: You need to format a drive, clean a corrupted disk, assign drive letters, or troubleshoot disk issues during recovery.
How to use it:
- Open an elevated Command Prompt (or the Command Prompt from the Recovery Environment).
- Type the following command and then press Enter: diskpart
- You are now in the DiskPart interactive environment.
- When finished, type exit and press Enter to return to the regular Command Prompt.
|
Command |
What it does |
|---|---|
|
list disk |
Shows all disks connected to your computer. |
|
select disk 0 |
Selects disk 0 (replace the disk number as needed). |
|
list partition |
Shows all partitions on the selected disk. |
|
select partition 1 |
Selects partition 1 (replace the number as needed). |
|
list volume |
Shows all volumes (drives with assigned letters). |
|
detail disk |
Displays detailed information about the selected disk. |
|
clean |
Removes all partitions and data from the selected disk. This erases everything. |
|
format fs=ntfs quick |
Formats the selected partition with the NTFS file system. |
|
assign letter=E |
Assigns or changes the drive letter of the selected volume. |
|
exit |
Exits the DiskPart environment. |
powercfg (Admin)
Displays and configures power settings. Especially useful on Dell laptops for generating battery health reports and diagnosing sleep or hibernate issues.
When to use it: Your laptop battery drains quickly, the computer does not sleep or wake properly, or you want to check battery health.
Useful commands:
|
Command |
What it does |
|---|---|
|
powercfg /batteryreport |
Generates a detailed battery health report saved as an HTML file. |
|
powercfg /energy |
Runs a 60-second diagnostic and creates an energy efficiency report. |
|
powercfg /sleepstudy |
Generates a report on modern standby activity and battery drain during sleep. |
|
powercfg /availablesleepstates |
Shows which sleep states your computer supports. |
|
powercfg /devicequery wake_armed |
Lists devices currently set to wake the computer. |
Example — generating a battery report:
- Open an elevated Command Prompt.
- Type the following command and then press Enter: powercfg /batteryreport
- The report is saved to your user folder. The Command Prompt displays the file path (typically C:\Users\YourName\battery-report.html).
- Navigate to that file location and open the file in your web browser to view the report.
System and Driver Information Commands
|
Command |
What it does |
Admin required? |
|---|---|---|
|
systeminfo |
Displays detailed system information including OS version, hardware specs, network configuration, and installed updates. |
No |
|
driverquery |
Lists all installed hardware drivers. |
No |
|
hostname |
Displays the name of your computer. |
No |
|
whoami |
Displays the currently signed-in user account. |
No |
|
winver |
Opens a window showing the exact Windows version and build number. |
No |
Example — saving system information to a file:
- Open a Command Prompt.
- Type the following command and then press Enter: systeminfo > C:\systeminfo.txt
- Open the file C:\systeminfo.txt in Notepad or any text editor to review.
8. Networking Commands
These commands help you diagnose and resolve network connectivity issues on your Dell computer.
ipconfig
Displays your computer's current network configuration, including IP address, subnet mask, and default gateway for each network adapter.
Useful variations:
|
Command |
What it does |
|---|---|
|
ipconfig |
Shows basic IP address information for all adapters. |
|
ipconfig /all |
Shows detailed network configuration including MAC address, DHCP, and DNS servers. |
|
ipconfig /release |
Releases the current IP address assigned by the DHCP server. |
|
ipconfig /renew |
Requests a new IP address from the DHCP server. |
|
ipconfig /flushdns |
Clears the DNS resolver cache. Helpful when websites are not loading correctly. |
Example — finding your IP address:
- Open a Command Prompt.
- Type the following command and then press Enter: ipconfig /all
- Look for your IPv4 Address, Subnet Mask, and Default Gateway under your active network adapter.
ping
Sends a small data packet to another device or website and measures the response. This helps determine whether your computer can reach another system.
Example: ping www.dell.com
Understanding the results:
- "Reply from..." — The destination is reachable. The time value (in milliseconds) indicates latency.
- "Request timed out" — The destination did not respond.
- "Destination host unreachable" — There is a routing or network configuration problem.
Tip: To ping continuously (useful for monitoring a connection as you make changes), use ping www.dell.com -t. Press Ctrl + C to stop.
tracert
Traces the route data takes from your computer to a destination, showing every network hop along the way. This helps identify where a connection breaks down.
Example: tracert www.dell.com
Each numbered line represents a hop. If a hop shows asterisks (*) or very high response times, the problem may be at that point.
pathping
Combines the functionality of ping and tracert. It traces the route to a destination and then sends multiple pings to each hop, providing detailed statistics on packet loss and latency at every point.
When to use it: You want more detailed network diagnostic information than either ping or tracert provides individually.
Example: pathping www.dell.com
nslookup
Queries the Domain Name System (DNS) to find the IP address associated with a domain name. DNS is the system that translates website names (like www.dell.com) into IP addresses that computers understand.
Example: nslookup www.dell.com
If you receive a valid address, DNS is working. If you see an error, there may be a DNS configuration problem.
netsh (Network Shell) (Admin)
A powerful networking tool that can configure, display, and reset various network settings. The most commonly used netsh commands reset the network stack to resolve persistent connectivity issues.
When to use it: You have tried releasing and renewing your IP address and flushing DNS, but network problems persist.
Network reset commands — run all three in order:
- Open an elevated Command Prompt.
- Type each command one at a time, pressing Enter after each:
- netsh winsock reset
- netsh int ip reset
- netsh advfirewall reset
- Restart your computer for the changes to take effect.
What each command does:
|
Command |
What it does |
|---|---|
|
netsh winsock reset |
Resets the Winsock catalog, which handles network communication between your apps and Windows. Fixes issues caused by corrupted network entries. |
|
netsh int ip reset |
Resets the TCP/IP stack (the foundation of your network communication). |
|
netsh advfirewall reset |
Resets Windows Firewall settings to their defaults. Useful if incorrect firewall rules are blocking connections. |
Tip: For a comprehensive network reset, you can run all the key networking commands in sequence:
- ipconfig /release
- ipconfig /flushdns
- ipconfig /renew
- netsh winsock reset
- netsh int ip reset
Then restart your computer.
netstat
Displays active network connections, listening ports, and network statistics.
Example: netstat -an
- -a — Shows all connections and listening ports.
- -n — Displays addresses and port numbers in numerical form.
To see which program is using each connection, use: netstat -ab
(Requires an elevated Command Prompt.)
Other Useful Networking Commands
|
Command |
What it does |
|---|---|
|
arp -a |
Displays the ARP (Address Resolution Protocol) cache, which maps IP addresses to MAC addresses on your local network. |
|
getmac |
Displays the MAC address of all network adapters on your computer. |
|
nbtstat -n |
Displays NetBIOS names registered by applications on your computer. |
|
netsh wlan show profiles |
Lists all saved Wi-Fi networks. |
|
netsh wlan show profile name="NetworkName" key=clear |
Shows the saved password for a specific Wi-Fi network. Replace NetworkName with your network name. The password appears under the Key Content field in the output. |
9. File and Folder Management Commands
These commands let you navigate your file system, manage files, and perform bulk operations from the Command Prompt.
|
Command |
What it does |
Example |
|---|---|---|
|
cd |
Changes the current directory (folder). |
cd C:\Users\Documents |
|
cd.. |
Moves up one directory level. |
cd.. |
|
cd\ |
Moves to the root of the current drive. |
cd\ |
|
dir |
Lists files and folders in the current directory. |
dir |
|
dir /s |
Lists files in the current directory and all subdirectories. |
dir /s *.log |
|
dir /a:h |
Lists hidden files in the current directory. |
dir /a:h |
|
copy |
Copies one or more files to another location. |
copy report.txt D:\Backup\ |
|
xcopy |
Copies files and directory trees. More options than copy. |
xcopy C:\Data D:\Backup /s /e |
|
robocopy |
Robust copy. Advanced file and folder copying with resume support, mirroring, and logging. Caution: the /mir switch deletes files at the destination that no longer exist at the source, so double-check both paths before running it. |
robocopy C:\Data D:\Backup /mir /log:C:\copy-log.txt |
|
move |
Moves a file to another location. |
move report.txt D:\Backup\ |
|
del |
Deletes one or more files. |
del oldfile.txt |
|
mkdir (or md) |
Creates a new directory (folder). |
mkdir C:\Projects\NewFolder |
|
rmdir (or rd) |
Removes an empty directory. Use /s to remove non-empty directories. |
rmdir /s C:\Projects\OldFolder |
|
rename (or ren) |
Renames a file or folder. |
rename oldname.txt newname.txt |
|
type |
Displays the contents of a text file. |
type readme.txt |
|
tree |
Displays the folder structure in a graphical tree format. |
tree C:\Users\Documents |
attrib (Admin for some changes)
Displays or changes file and folder attributes such as read-only, hidden, system, and archive.
When to use it: You need to reveal hidden files, remove read-only restrictions, or investigate files that may be hidden by malware.
Common attributes:
|
Attribute |
Meaning |
|---|---|
|
R |
Read-only |
|
H |
Hidden |
|
S |
System |
|
A |
Archive |
Examples:
|
Command |
What it does |
|---|---|
|
attrib C:\file.txt |
Displays the attributes of the specified file. |
|
attrib -h -s C:\file.txt |
Removes the hidden and system attributes from the file, making it visible. |
|
attrib +r C:\important.txt |
Makes the file read-only. |
|
attrib -h -r -s /s /d C:\Folder\*.* |
Removes hidden, read-only, and system attributes from all files and subfolders in the specified folder. |
10. Commonly Used Commands Quick Reference
This table provides a quick reference for additional frequently used commands. For the complete list of every command, see the Microsoft Command-Line Reference A-Z.
|
Command |
Description |
Example |
|---|---|---|
|
cls |
Clears the Command Prompt screen. |
cls |
|
echo |
Displays a message or turns command echoing on or off. |
echo Hello World |
|
exit |
Closes the Command Prompt window. |
exit |
|
shutdown /s /t 0 |
Shuts down the computer immediately. |
shutdown /s /t 0 |
|
shutdown /r /t 0 |
Restarts the computer immediately. |
shutdown /r /t 0 |
|
shutdown /a |
Cancels a scheduled shutdown. |
shutdown /a |
|
shutdown /i |
Opens the Remote Shutdown dialog box (useful for networked computers). |
shutdown /i |
|
tasklist |
Lists all running processes. |
tasklist |
|
taskkill /IM name.exe /F |
Forces a running process to end. |
taskkill /IM notepad.exe /F |
|
taskkill /PID 1234 /F |
Ends a process by its Process ID. |
taskkill /PID 5678 /F |
|
gpupdate /force |
Immediately refreshes Group Policy settings (useful in business environments). |
gpupdate /force |
|
winget list |
Lists all installed applications (Windows Package Manager). |
winget list |
|
winget upgrade --all |
Updates all applications that have available updates. |
winget upgrade --all |
|
help |
Displays a list of available commands. |
help |
|
command /? |
Displays help for a specific command. |
ping /? |
11. Wildcards, Operators, and Output Redirection
Understanding wildcards, operators, and output redirection lets you work more efficiently in the Command Prompt.
Wildcards
Wildcards are placeholder characters that represent one or more other characters. They are useful when you want to work with multiple files at once.
|
Wildcard |
Meaning |
Example |
|---|---|---|
|
* |
Matches any number of characters. |
dir *.txt lists all text files. |
|
? |
Matches exactly one character. |
dir report?.txt matches report1.txt, report2.txt, but not report10.txt. |
More examples:
|
Command |
What it does |
|---|---|
|
del *.tmp |
Deletes all files with the .tmp extension in the current folder. |
|
copy *.docx D:\Backup\ |
Copies all Word documents to the Backup folder on D: drive. |
|
dir C:\Users\*.log /s |
Searches for all .log files in the Users folder and all subfolders. |
Chaining Commands
You can run multiple commands in sequence on a single line.
|
Operator |
Meaning |
Example |
|---|---|---|
|
&& |
Runs the second command only if the first command succeeds. |
mkdir NewFolder && cd NewFolder |
|
|| |
Run the second command only if the first fails |
cd NonExistent || echo Folder not found |
|
& |
Runs both commands regardless of whether the first succeeds or fails. |
echo Starting & dir |
Output Redirection
You can save command output to a file instead of displaying it on screen.
|
Operator |
What it does |
Example |
|---|---|---|
|
> |
Sends output to a file, overwriting the file if it already exists. |
ipconfig /all > C:\network-info.txt |
|
>> |
Appends output to the end of an existing file (does not overwrite). |
systeminfo >> C:\report.txt |
|
| (pipe) |
Sends the output of one command as input to another command. |
dir /s | find ".log" |
12. Customizing the Command Prompt
You can change the appearance of the Command Prompt window to make it more comfortable to work with.
Change Settings Through Properties
Good to know: This Properties dialog belongs to the classic Command Prompt window (conhost). If you opened Command Prompt inside Windows Terminal (the default on Windows 11), right-click the title bar instead goes to Windows Terminal’s own controls — use its Settings (Ctrl+,) to change fonts, colors, and appearance instead.
- Right-click the title bar of the Command Prompt window.
- Select Properties.
- Use the available tabs to customize:
-
- Font — Change the font type and size.
- Layout — Adjust the window size and screen buffer size.
- Colors — Change the text and background colors, and adjust the opacity (transparency).
- Terminal — Configure cursor shape and other terminal-specific settings.
- Select OK to apply your changes.
Change Colors Using Commands
You can also change colors directly using the color command: color 0A
The first character sets the background color and the second sets the text color. Common values include:
|
Value |
Color |
|---|---|
|
0 |
Black |
|
1 |
Blue |
|
2 |
Green |
|
3 |
Aqua |
|
4 |
Red |
|
5 |
Purple |
|
6 |
Yellow |
|
7 |
White |
|
A |
Light Green |
|
B |
Light Aqua |
|
C |
Light Red |
|
F |
Bright White |
To return to the default colors, type color with no values and press Enter.
Change the Window Title
To set a custom title for the Command Prompt window: title My Dell Diagnostics
13. Helpful Keyboard Shortcuts
These keyboard shortcuts make working in the Command Prompt faster and easier.
|
Shortcut |
Action |
|---|---|
|
Up arrow / Down arrow |
Cycle through previously used commands. |
|
Right arrow |
Retype the previous command one character at a time. |
|
Tab |
Auto-complete file and folder names. Press repeatedly to cycle through matches. |
|
Ctrl + C |
Cancel (stop) the currently running command. |
|
Ctrl + A |
Select all text in the Command Prompt window. |
|
Ctrl + V |
Paste text from the clipboard. |
|
Ctrl + M |
Enter Mark mode to select text with the mouse or keyboard. |
|
Ctrl + F |
Open the Find dialog box to search for text in the Command Prompt output. |
|
F1 |
Retype the previous command one character at a time (same as Right arrow). |
|
F3 |
Retype the last command in full. |
|
F5 |
Cycle through previously used commands (same as Up arrow). |
|
F7 |
Display a pop-up window showing the command history. Use arrow keys to select a command. |
|
F9 |
Run a specific command from the history by its number (shown in the F7 list). |
|
Alt + Enter |
Toggle between full-screen and windowed mode. |
|
Ctrl + Shift + Plus (+) |
Increase font size. |
|
Ctrl + Shift + Minus (-) |
Decrease font size. |
14. Frequently Asked Questions
Q: How do I cancel a running command?
A: Press Ctrl + C to stop a command that is currently running. This does not undo actions the command has already completed — it only stops the command from continuing.
Q: How do I shut down or restart my computer from the Command Prompt?
A: Use the following commands:
|
Command |
What it does |
|---|---|
|
shutdown /s /t 0 |
Shuts down immediately. |
|
shutdown /r /t 0 |
Restarts immediately. |
|
shutdown /s /t 60 |
Shuts down after 60 seconds. Adjust the number for a different delay. |
|
shutdown /a |
Cancels a scheduled shutdown. |
|
shutdown /i |
Opens the Remote Shutdown dialog box for networked computers. |
|
shutdown /l |
Signs out the current user. |
Q: How do I access previous commands I have entered?
A: Press the Up and Down arrow keys to scroll through your command history. You can also press F7 to see a pop-up list of all recently entered commands, and use the arrow keys to select one.
Q: Can I copy and paste text in the Command Prompt?
A: Yes. Use Ctrl + C to copy selected text and Ctrl + V to paste text. To select text, click and drag with your mouse, or press Ctrl + A to select everything visible.
Q: Can I save the output of a command to a file?
A: Yes. Add > filename.txt after any command to save its output to a text file. For example: ipconfig /all > C:\network-info.txt
To add output to an existing file without overwriting it, use >>: systeminfo >> C:\system-report.txt
Q: Why does a command say "Access is denied"?
A: This usually means the command requires administrator privileges. Close the current Command Prompt window and reopen it as an administrator. See Section 4 for step-by-step instructions.
Q: Why do I see "Terminal" instead of "Command Prompt" when I right-click the Start button?
A: Windows uses Windows Terminal as the default command-line application. Windows Terminal is a modern app that can host Command Prompt, PowerShell, and other command-line tools in tabs within a single window. You can still open the traditional Command Prompt inside Windows Terminal or on its own. See Section 3 for detailed instructions.
Q: What is the difference between Command Prompt and PowerShell?
A: Command Prompt is the classic Windows command-line tool, best suited for basic troubleshooting and file management tasks. PowerShell is a more powerful tool designed for advanced system administration, automation, and scripting. For most everyday troubleshooting tasks that Dell Support recommends, Command Prompt works well. See Section 2 for a detailed comparison.
Q: How do I find my computer's IP address using the Command Prompt?
A: Open a Command Prompt and type ipconfig then press Enter. Look for the IPv4 Address listed under your active network adapter (usually labeled "Wireless LAN adapter Wi-Fi" or "Ethernet adapter Ethernet").
Q: How do I check my battery health from the Command Prompt?
A: Open an elevated Command Prompt and type powercfg /batteryreport then press Enter. The command generates an HTML report saved in your user folder. Navigate to the file path shown and open the report in your web browser. See the powercfg section for more battery and power commands.
Q: How do I reset my network settings using the Command Prompt?
A: Open an elevated Command Prompt and run the following commands in order, pressing Enter after each:
- ipconfig /release
- ipconfig /flushdns
- ipconfig /renew
- netsh winsock reset
- netsh int ip reset
Restart your computer after running these commands. See the netsh section for more details.
Q: How do I repair Windows startup files from the Command Prompt?
A: Access the Command Prompt from the Recovery Environment (see Section 5), then run the bootrec commands described in the Boot Repair Commands section.
Q: Where can I find a complete list of all available commands?
A: Type help in the Command Prompt to see a list of common commands. For the complete reference, visit the Microsoft Command-Line Reference A-Z.