Use Command Prompt commands by category: file tools like dir and copy, network checks like ipconfig and ping, and repair tools like sfc /scannow; if a command fails, verify spelling, PATH, admin rights, and system file health. Bad CMD guesses can burn hours, hit the wrong folder, or leave broken networking and repair jobs unresolved. This guide maps the commands worth knowing, what each does, and the quickest fixes when CMD or a command will not run.

What is Command Prompt, and when should you use it instead of PowerShell?

Command Prompt is the Windows command-line shell launched by cmd.exe. It runs built-in Windows Commands, accepts batch .bat scripts, and handles quick one-off tasks well. Microsoft says Windows has two command-line shells: Command shell and PowerShell, and Microsoft recommends PowerShell for the latest, up-to-date Windows automation.

What cmd.exe does on Windows 11 and Windows Server

Command Prompt is still present on Windows 11 and Windows 10. Microsoft also lists Windows Server 2025 and Windows Server 2016 on the Windows commands reference, and this practical command set also fits common admin work on Windows Server 2022 and Windows Server 2019.

For normal users, CMD is often the fastest way to check a folder, flush DNS, print IP details, or run a repair command. It is text-first, predictable, and fast for direct tasks.

Built-in Windows Commands, batch files, and redirection

CMD can run built-in Windows Commands such as dir, cd, ipconfig, and ping. It also runs batch files, which makes it useful for repeatable support steps.

Redirection operators matter because they turn a quick check into a saved record. Use > to write output to a file, >> to append, and | to pass output into another command. Example: ipconfig /all > net.txt saves adapter details for later review.

When CMD is the faster tool, and when PowerShell is the better fit

Use CMD for short built-in commands, older scripts, and recovery tasks that many support documents still write in CMD syntax. Use PowerShell when work includes structured output, modern automation, remote administration, or script logic that would be awkward in batch files.

PowerShell can also run many Windows Commands, but Command Prompt and PowerShell are not the same tool. If output needs sorting, object filtering, or repeatable admin work at scale, PowerShell is usually the better call.

Why isn’t Command Prompt showing in Windows, and how do you restore it?

If Command Prompt seems to be missing, the fix depends on what is actually happening: it may be hidden from Search, launching only through Windows Terminal, or blocked by a policy or broken path. This supporting guide breaks those cases apart so you can check the right setting instead of guessing. It also explains how to confirm whether cmd.exe is still present on Windows 10 or Windows 11 and what to do if it is disabled or damaged. If you’re troubleshooting a missing CMD shortcut or menu entry, Command Prompt missing shows the fastest way to narrow it down.

How do you open Command Prompt as administrator?

Open Command Prompt as administrator by searching for cmd from Start and choosing Run as administrator, or by using Task Manager to start cmd.exe with admin rights. An elevated prompt is often needed for repair, service, and system change commands, and the window title may show Administrator.

Fast ways to launch cmd.exe

  1. Press the Windows key or click Start, type cmd, then press Enter to open a standard prompt.
  2. Press Win + R, type cmd, then press Enter.
  3. Open Windows Terminal and choose Command Prompt if that profile is available.
  4. Open Task Manager, choose Run new task, type cmd.exe.

How to launch an elevated prompt

  1. Open Start and type cmd.
  2. Select Run as administrator.
  3. Approve the User Account Control prompt.
  4. Confirm elevation by checking that the title includes Administrator.

Commands such as sfc, DISM, chkdsk in some modes, shutdown in managed settings, and service changes often need elevation. If a command returns Access is denied, retry it in an elevated window before changing anything else.

What to do if Command Prompt will not open or closes at once

If CMD flashes and closes, start it from Task Manager instead of a desktop shortcut, or run cmd /k so the window stays open after a failing startup command. If it will not launch at all, test system files with sfc /scannow from an elevated session if another admin path still works.

If only normal launch paths fail, check whether a broken shortcut, policy setting, or Terminal profile is involved. If every launch path fails, system file damage is more likely than a bad command.

Why does Command Prompt keep opening by itself?

If Command Prompt keeps popping up, the key is to match the timing to the likely trigger: startup items or Task Scheduler at sign-in, a scheduled task or updater after login, or a recurring task if it appears on a timer. The supporting guide breaks down those patterns so you can focus on the source instead of guessing at random fixes. It also explains when the issue is more likely a misbehaving app, an Office task, or malware, which matters because each cause needs a different solution.

Use this Command Prompt pop-up guide to narrow the cause, choose the right repair step, and stop the window from returning.

The command map: 40 essential CMD commands by task

The fastest way to use CMD well is to pick a command by job, not by alphabet. Start with safe read-only commands for facts, then move to change-making commands, and only then use repair or delete commands that can alter the system or remove data.

dir lists files, cd changes folders, pushd stores the current location before jumping elsewhere, popd returns, and tree prints a folder map. These are low-risk and should be the first stop when a path error appears.

File and folder work

mkdir, rmdir, copy, xcopy, robocopy, move, ren, del, type, and attrib cover most local file jobs. The risk jumps when deletion, overwrite, or recursive folder removal enters the picture, so the matrix below flags those cases.

Network and system checks

ipconfig, ping, tracert, nslookup, netstat, tasklist, systeminfo, and findstr answer common support questions quickly. In practice, they turn a vague report like “the internet is down” into a narrower fault path, adapter, DNS, route, or app.

Command-to-use-case matrix

This matrix is the field guide section: each command maps to a real outcome, the privilege level it usually needs, the failure you are most likely to hit, and a safer fallback when the direct command is too risky or too broad. Read-only commands are the best first move when the cause is still unclear.

How to read the matrix

Required privilege means the minimum prompt level commonly needed. User means a standard prompt usually works. Admin means open an elevated prompt first. Higher-risk marks commands that can delete, rewrite, stop services, or change boot or network behavior if typed carelessly.

Command Best use Required privilege Likely error Safer alternative
helpSee built-in syntax helpUserBad parameterhelp commandname
dirList files in current folderUserFile not founddir /p
cdChange working folderUserThe system cannot find the path specifiedpushd "path"
pushdJump to another path and save current oneUserPath not foundcd /d "path"
popdReturn to previous folderUserNo saved path contextcd
treeView folder structureUserAccess is denieddir /s /b
clsClear screen clutterUserNone in normal useStart a new prompt
exitClose CMD windowUserCloses active sessionOpen a second prompt first
echoPrint text or variablesUserUnexpected variable expansionset variable then echo
typeRead text file contentsUserThe system cannot find the file specifiedmore filename
morePage long text outputUserFile not foundtype file | more
findFind plain text in output or filesUserBad command or file namefindstr
findstrSearch text with patternsUserNo matches foundfindstr /i "text" file
mkdirCreate a folderUserAccess is deniedCreate under user profile
rmdirRemove an empty folderUserThe directory is not emptyReview with dir first
copyCopy one or a few filesUserFile not foundUse full quoted paths
xcopyCopy folder trees in older workflowsUserInvalid number of parametersrobocopy
robocopyCopy folders with retries and resume logicUserPath not foundcopy for one file
moveMove files or foldersUserCannot find the file specifiedcopy then verify then delete
renRename files fastUserThe system cannot find the file specifiedRename one file at a time
delDelete filesUser, higher-riskAccess is deniedMove file to a review folder first
attribView or change file attributesUserAccess is deniedCheck properties in File Explorer
whereFind executable pathUserINFO: Could not find filesCheck PATH and spelling
setView or set environment variablesUserVariable confusionset variable=value in same session only
pathView or set executable search pathUser, higher-riskCommand not recognized after editsUse where first
ipconfigShow IP, gateway, DNS, adaptersUserMedia disconnected confusionipconfig /all
pingTest basic reachabilityUserRequest timed outPing the gateway first
tracertTrace route hopsUserTimeout at a hoppathping
pathpingTrace route with packet-loss viewUserLong run timetracert for a quick path
nslookupCheck DNS answersUserNon-existent domainPing a known IP to separate DNS from routing
netstatList ports and connectionsUserOutput too noisynetstat -ano | findstr :port
arpView local ARP cacheUserNo matching entryPing host first
route printRead current route tableUserMisread default routeipconfig first
tasklistSee running processesUserAccess denied for some detailstasklist | findstr name
taskkillEnd a stuck processUser or Admin, higher-riskAccess is deniedClose app normally first
systeminfoView OS and hardware summaryUserTakes time on some systemsver for simple OS build text
verShow Windows version textUserToo little detailsysteminfo
chkdskCheck file system stateAdmin for repair modes, higher-riskVolume in useRun read-only first
sfc /scannowRepair protected system filesAdminWindows Resource Protection could not perform the requested operationRun DISM first if image damage is suspected
DISM /Online /Cleanup-Image /RestoreHealthRepair Windows imageAdminError 87 or source issuesCheck syntax, then SFC after DISM
shutdown /r /t 0Restart immediatelyAdmin in managed contexts, higher-riskAccess is deniedUse Start menu restart

Safe everyday commands versus higher-risk system commands

Safe everyday commands are mostly read-only: dir, cd, type, ipconfig, ping, systeminfo, tasklist. Higher-risk commands include del, rmdir, taskkill, path, chkdsk repair modes, DISM, and forced restarts.

Use the read-only check first. If the folder, adapter, route, or process facts are wrong, the change command that follows is more likely to be right.

How do you move around and work with files in Command Prompt?

Use cd to change folders, cd /d to switch folder and drive together, and quotes around paths with spaces. For file work, verify location with dir before using copy, move, ren, or del. Most path mistakes come from wrong folders, missing quotes, or the wrong drive.

Changing directory, switching drives, and handling spaces

To move into a folder on the same drive, type cd FolderName. To move to a different drive and path in one step, use cd /d D:\Logs. For spaces, use quotes: cd /d "C:\Program Files".

If the prompt is on C: and the target is on D:, typing only D: switches drives, but it does not move into the full path. That trips people up all the time, and it causes many false “path not found” reports.

Viewing, creating, renaming, moving, and deleting without mistakes

Use dir before changes. Then use mkdir NewFolder, ren old.txt new.txt, copy source.txt target.txt, or move report.txt D:\Archive\. For deletes, review first with dir, then run del file.txt or rmdir FolderName only after confirming the target.

For large folder copies, robocopy is usually safer than xcopy. It gives clearer behavior for directory copies and is easier to re-run when a transfer is interrupted.

Using redirection and pipes for quick capture and filtering

Redirection saves evidence. Example: dir /s > files.txt writes a full file listing to a text file. Piping cuts noise: tasklist | findstr chrome shows only matching processes. Use these when the screen scrolls too fast or when output needs sharing.

How to switch drives and folders correctly in CMD

To navigate between different folders and storage drives effectively, you need to understand the mechanics of the cd command. While standard path entries work for same-drive navigation, switching to a different drive requires the /d flag, and paths containing spaces must be enclosed in quotation marks. Failing to use the correct syntax leaves the terminal in the current location, which routinely breaks build scripts and file operations.

The complete command prompt change directory guide covers prerequisites, drive-switching rules, shortcuts for common locations like the Desktop, and a troubleshooting checklist for failed path transitions.

Which CMD commands help most with networking and PC diagnostics?

The best diagnostic commands are ipconfig for adapter facts, ping for basic reachability, nslookup for DNS, tracert or pathping for route checks, and netstat, tasklist, and systeminfo for local state. Run them in that order to separate local faults from DNS, routing, or app issues.

Finding your IP address and adapter details with ipconfig

Type ipconfig to see IPv4 address, subnet mask, and default gateway for active adapters. Type ipconfig /all for a fuller view that includes DNS servers, DHCP details, and adapter names. This is the quickest way to answer “what network am I actually on?”

If the result says Media disconnected, that adapter is present but not carrying traffic. Move to another adapter section before assuming the whole PC is offline.

Testing reachability, DNS, and routes

Use ping 127.0.0.1 to test the local TCP/IP stack, then ping the default gateway, then a public IP, then a host name. That order separates local stack issues from router, internet, and DNS issues.

Use nslookup example.com when a site name fails but direct IP access still works. Use tracert for a quick path view and pathping when packet loss is suspected and a slower, more detailed route picture is worth the wait.

Checking ports, connections, processes, and system facts

netstat -ano shows active connections and listening ports with process IDs. Pair it with tasklist to map a port to a process. Use systeminfo when a support case needs Windows build, install date, or boot time context.

What should you type to repair Windows from Command Prompt?

Start with sfc /scannow in an elevated Command Prompt to check and repair protected Windows system files. If SFC reports it could not complete or could not fix some files, run DISM /Online /Cleanup-Image /RestoreHealth, then run SFC again. Both commands need administrator rights.

Running SFC and reading the result

sfc /scannow checks protected system files against known-good copies. If it reports that it found corrupt files and repaired them, restart and test the original problem. If it reports no integrity violations, the fault may sit elsewhere: drivers, apps, disk state, or policy settings.

Using DISM when SFC cannot fix the image

DISM /Online /Cleanup-Image /RestoreHealth repairs the Windows image that SFC depends on. If DISM throws a syntax error such as a bad parameter, recheck spacing and slashes exactly. After DISM completes, run sfc /scannow again to repair files against the refreshed image.

Other repair-adjacent commands

chkdsk helps when the file system itself may be at fault, especially after abnormal shutdowns or storage warnings. Use read-only checks first if the system is still booting normally. Forced repair modes can require a restart and should not be the first reaction to every Windows problem.

Repairing bad sectors with CHKDSK in Command Prompt

CHKDSK /f /r can repair file-system errors and remap weak logical sectors, but it cannot fix physical damage. If the command reports unreadable sectors or bad blocks keep returning, further scans risk stressing a failing drive.

Before running any repair, back up your important files immediately. The guide on fixing bad sectors explains exactly what CHKDSK handles, how to target logical errors in Windows 10, when SSDs behave differently, and why cloning the drive is often the safer choice once physical degradation begins.

Troubleshooting No Internet in Windows with Command Prompt

When Windows claims you’re connected but no web pages load, Command Prompt can quickly isolate the issue. This guide outlines a step-by-step flow—starting with DNS flushes, IP renewals, and Winsock resets—while explaining which commands to run first and when to escalate to router or ISP checks. The symptom-based approach avoids wasted attempts on unrelated fixes, saving time for users stuck in diagnostic loops.

For a structured walkthrough of exact commands, expected outcomes, and when to stop troubleshooting in CMD, see the internet connection fixes guide.

When Command Prompt is missing in Advanced options

If the Command Prompt option disappears from Advanced options, the issue is usually with how Windows Recovery Environment is loading—not with CMD itself. The next step depends on whether you can still reach Startup Settings, Safe Mode, or a recovery screen that offers a shell. This command prompt recovery guide explains what each symptom means and which path to try first.

That matters because the right fix changes depending on where the menu fails. If Advanced options boots you back to Windows, the article points you to alternate recovery paths; if Safe Mode or WinRE is available, it shows how to use that access to open Command Prompt and continue troubleshooting.

How do you choose the right network reset in Command Prompt?

If Windows networking is broken, the fastest fix is not always a full reset. The supporting guide explains which Command Prompt command fits each problem: network reset commands for DNS lookup failures, socket errors, TCP/IP corruption, or adapter-specific issues. That matters because using the wrong reset can waste time and change settings you did not need to touch.

Use this section when you want a practical decision path instead of trial and error. It helps you match the symptom to the command, understand the risk of each reset, and know what to check afterward so you can confirm the connection is actually repaired.

How to reset a Windows local account password using Command Prompt

Command Prompt can reset a Windows 10 or 11 local account password, but only if you already have administrator access or an approved recovery path. It cannot legitimately reset a Microsoft account password, and offline workarounds risk locking you out permanently or breaking access to encrypted files.

The supporting guide explains exactly what CMD can change, when it is safe to use, and how to choose the right recovery method for local versus Microsoft accounts. It also includes a decision table, troubleshooting steps for failed commands, and a rollback checklist for file-swap methods. Before attempting any changes, review how to reset user password safely to avoid unintended data loss or account protection triggers.

Why Command Prompt can appear stuck at 62.3%

If Command Prompt seems frozen at 62.3%, the issue is often a normal pause rather than a true lockup. The supporting article explains how to tell whether the process is still working, what common causes can slow it down, and which signs point to a real stall that needs action.

It also lays out practical next steps for cases where the progress never moves, including checks for system resource pressure, background disk activity, and command-specific delays. If you want a clearer way to judge whether to wait or troubleshoot, the command prompt stuck guide gives a focused breakdown.

Why Command Prompt may open but not accept typing

If Command Prompt opens yet ignores your keystrokes, the issue is often a window-state or console-mode problem, not a broken keyboard. The supporting guide explains the most common causes, starting with simple checks like whether text is selected in the window and whether you opened the real cmd.exe console instead of a different terminal. Those details matter because they can make CMD seem frozen even when Windows is working normally.

It also covers cases where Windows Terminal settings or legacy console mode affect input, plus what a blinking dash can mean. If you need to narrow down why typing fails and avoid changing the wrong setting first, see Command Prompt typing issues.

How do you fix common CMD errors and annoyances?

How do you fix common CMD errors and annoyances?

Most CMD failures fall into a few buckets: spelling and PATH issues, wrong folder, missing quotes, missing elevation, files locked by running apps, or bad syntax. Fix the error text literally, one layer at a time, rather than jumping to repair tools before confirming the command and location are correct.

Fixing “is not recognized,” “path not found,” and bad parameter

If a command is not recognized, check spelling first, then run where commandname for external tools, and use help for built-in syntax. If a path is not found, confirm the current folder with cd and use quotes around any path with spaces.

Bad parameter usually means the command exists but the switch or order is wrong. Built-in help is often enough: help copy, help del, or the command followed by /?.

Fixing access denied, file in use, and admin-only failures

Access is denied can mean either permissions or a locked file. Retry the command in an elevated prompt if the action touches system folders, services, or repair tools. If a file is in use, close the app that owns it, then confirm the process with tasklist before trying again.

If taskkill is required, prefer closing one named app instead of force-ending broad process groups. Forced kills can drop unsaved work.

Enabling command, file, and directory completion

Microsoft says file and directory completion can be enabled with cmd.exe /F:ON or disabled with /F:OFF. When enabled, Ctrl-D completes directory names and Ctrl-F completes file names. This matters when long paths are causing repeated typing errors.

Completion behavior can also be changed in the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\CompletionChar and HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor\PathCompletionChar. Microsoft says those values use the REG_DWORD type.

If completion still does not behave as expected, test a fresh prompt started with cmd.exe /F:ON before editing the registry. That is the lower-risk check.

Frequently asked questions

What are the most useful Command Prompt commands in Windows?

The most useful commands for everyday support work are dir, cd, copy, move, del, ipconfig, ping, nslookup, netstat, tasklist, systeminfo, and sfc /scannow. They cover location, file handling, networking, process checks, system facts, and repair without turning into an A-Z dump.

How do I fix Command Prompt not opening?

Try another launch path first: Start search, Win + R, Task Manager, or Windows Terminal. If CMD opens and closes instantly, run cmd /k so the window stays open. If all methods fail, use an available admin path to run sfc /scannow and check system file health.

How do I change directory in Command Prompt?

Use cd FolderName for the current drive, or cd /d D:\Path\Here to switch drive and folder together. Put quotes around paths with spaces, such as cd /d "C:\Program Files". If CMD says the path is not found, confirm the exact folder name with dir.

How do I find my IP address using Command Prompt?

Type ipconfig to see the IPv4 address, subnet mask, and default gateway for active adapters. Use ipconfig /all for full adapter details, including DNS servers and DHCP state. If one adapter shows Media disconnected, check another listed adapter before assuming the whole network stack is down.

Is Command Prompt still useful in Windows 11?

Yes. Microsoft says supported Windows versions include Windows 11 and Windows 10, and CMD remains a fast tool for direct checks, old batch files, and repair commands. PowerShell is the better fit for modern automation, but Command Prompt still handles many one-step diagnostics faster than a larger scripting environment.