If your Command Prompt does not work — it opens and closes instantly, throws an error, rejects typed commands, or refuses to launch at all — the fix is almost always one of a few things: the window is being closed by a startup script, the executable path is broken, a third-party program has replaced the shortcut, or Windows is blocking the app. Work through the checks below in order; most people find the cause within the first three steps. Nothing here is risky, but later steps involve editing the system PATH and repairing system files, so read each step before doing it.
What You'll Need
- A Windows PC where you can sign in with an administrator account (many fixes require admin rights).
- An internet connection, for checking updates and downloading an official repair tool if needed.
- Another way to open a terminal in case Command Prompt itself will not start: Windows Terminal or the built-in PowerShell.
- About 15 minutes, and a note of what you were doing when it last worked.
Step-by-Step
- Decide what "doesn't work" means. The solution depends on the symptom, so pin it down first. Does the window flash and vanish? Does it open but say "not recognized as an internal or external command"? Does it refuse to open at all? Does typing feel dead (no cursor response)? Write down the exact wording of any error message — you will need it later. Menu labels and wording can differ slightly by Windows version, edition and region, so match on meaning rather than exact text.
-
Open Command Prompt without the shortcut. Shortcuts are a common culprit. Press Windows key + R, type
cmdin the Run box and press Enter. If that works but the Start menu icon does not, the problem is the shortcut or pin, not the program. You can also open Windows Terminal from the Start menu and choose Command Prompt from the tab drop-down arrow to test whether the shell itself is healthy. - Restart the PC properly. Shutting the lid or clicking Shut down can leave a partial sleep state behind on some laptops. Choose Start > Power > Restart (not Shut down) and try again. This clears stuck background processes that can hold the console window and cause instant closing.
-
Check whether a startup command is closing the window. If you (or a tutorial you followed) added something to a startup key, a batch file can run one command and exit, making the window flash. Right-click the Start button, open Task Manager, and look through the Startup apps tab for anything unfamiliar that launches a script, then disable it temporarily. Also check the Run dialog's history and any
.bator.cmdfiles in your Startup folder: press Windows + R, typeshell:startup, and inspect what is listed there. Removing your own shortcut files from that folder is safe; do not delete files you do not recognise without noting what they are. - Run it as administrator. Some commands fail with access errors unless the window is elevated. Right-click Command Prompt in the Start menu and choose Run as administrator. If the option is missing or greyed out, your account may not be an administrator on that PC — that alone explains a lot of "nothing works" reports.
-
Run a quick system file check. A corrupted console executable is a real possibility. Open Windows Terminal or PowerShell as administrator and run
sfc /scannow. Let it finish — it can take several minutes and will report whether it repaired anything. Follow it withDISM /Online /Cleanup-Image /RestoreHealthif the first tool reports unrepaired corruption. Both use built-in Windows tools and need an internet connection for DISM. -
Check the PATH variable if commands are "not recognized". If Command Prompt opens fine but basic commands such as
ipconfigfail, the system PATH is probably damaged. Open Settings > System > About > Advanced system settings, click Environment Variables, select Path under System variables and check that it contains the Windows system folder entries. If you are not confident editing these values, take a screenshot first and change nothing else; a mistyped PATH can break other programs. - Rule out security software. Some third-party antivirus and "hardening" tools block command shells. Temporarily disabling your security software is a diagnostic step only — turn it back on afterwards. If Command Prompt works with it paused, look through that program's settings for an exception or a shell-protection list and add Command Prompt there, or contact the vendor's support. Do not uninstall security software just to make a terminal open.
- Reset the app entry in Windows settings. Go to Settings > Apps > Installed apps, find Windows Terminal or the Command Prompt entry, and look for the Advanced options / Repair entry. Use Repair first; Reset comes second because it clears that app's saved settings, including your profiles and default shell choice. Your files and documents are not affected.
- Test from a new user account. Create a temporary local account and sign in. If Command Prompt works there, the fault lies in your profile's configuration, not the system files — which narrows the search considerably. You can remove the test account when finished.
- Install pending Windows updates. Open Settings > Windows Update and install anything waiting. Console and Terminal fixes ship through updates, and a pending restart can leave components in a broken state.
Common Mistakes
- Running commands in the wrong shell. A command written for PowerShell often fails in Command Prompt, and vice versa. Check the window title before pasting anything.
- Deleting startup items blindly. Removing unknown entries from the Startup folder can disable drivers or sync tools. Note the filename before you remove it.
- Editing PATH without a backup. One missing semicolon can break other installed programs. Copy the value into a text file first.
- Leaving security software off. Disabling antivirus is a test, not a fix. Re-enable it as soon as you have your answer.
- Pasting commands from random forums. Only run commands you understand, and check them character by character — an extra space or slash is enough to do something unintended.
- Assuming a flashing window means "broken". It usually means a script ran and exited, which is a configuration problem, not a crash.
Tips
- Keep a PowerShell window open while you fix Command Prompt — it gives you a working shell to run repairs from.
- Use Windows Terminal as your daily shell; it runs Command Prompt as a profile and is more forgiving of bad console settings.
- Before any big change, create a restore point from the System Protection settings so you can roll back.
- If a specific command fails rather than the whole app, search the exact error wording — it almost always identifies the missing program or path.
- Type commands rather than pasting when you are unsure; it forces you to notice mistakes.
Troubleshooting
The window opens and closes immediately. Run cmd /k from the Run box. The /k switch keeps the window open after the command finishes, so you can read any error before it disappears.
"Access is denied" on every command. You are likely in a non-elevated window or a restricted account. Run as administrator, or ask the PC's administrator to check your account type.
Command Prompt is missing from the Start menu. Open Windows Terminal instead; Command Prompt is available as a profile inside it. You can also launch it from the Run box as described above.
System File Checker finds nothing but the problem persists. Move on to the new-user-account test. If a fresh profile works, copy your documents out and continue using the new account, or have a technician migrate the profile.
If none of this works, back up your files and consider Windows' built-in reset options, starting with the option that keeps your files. A full reset removes installed programs and settings, so treat it as a last resort. For hardware-level faults, a repair shop is the right next step rather than repeated resets.
Frequently Asked Questions
Why does Command Prompt close as soon as I open it?
Usually something in your startup configuration runs one command and exits, or the shortcut's target has been altered. Try cmd /k from the Run dialog to keep the window open and read the message.
Is Windows Terminal the same as Command Prompt?
No. Windows Terminal is a host application that can run Command Prompt, PowerShell and other shells as separate profiles. Fixing Terminal does not always fix Command Prompt, which is why the Run box test matters.
Can I fix Command Prompt without administrator rights?
Some steps, such as the file check and PATH editing, need administrator rights. Without them you can still test alternate launch methods and report the exact error to whoever administers the PC.
Will repairing or resetting the app delete my files?
No. Repair and Reset affect the app's own configuration only. A full Windows reset is different and can remove programs and settings, so back up first.
Why do only some commands fail?
That points to a PATH problem or a missing program rather than a broken Command Prompt. Check the PATH variable and confirm the tool you are calling is actually installed.
Should I disable my antivirus to test this?
Only briefly as a diagnostic, and re-enable it straight away. If the security software is the cause, add an exception for Command Prompt instead of leaving protection off.