If Command Prompt is not working in Windows 11, the quickest fix is almost always to try Windows Terminal instead: press Win + X and choose Terminal (or Terminal (Admin)). Windows 11 routes the old Command Prompt entries to Windows Terminal by default, so what looks like a broken cmd.exe is often just a setting or profile that got changed. If Terminal fails too, restart the PC, run a Quick scan in Windows Security, and then check the system files with the Deployment Image Servicing and Management tool (DISM) followed by System File Checker (SFC). Those four moves resolve the large majority of cases where cmd opens and closes, refuses to launch, or throws an error. Below are the full steps in the order that makes sense, from safest and simplest to the more invasive repairs.

What You'll Need

  • Your Windows 11 administrator account, because several steps require elevation and will prompt for permission.
  • An internet connection, needed if you must reinstall a Windows component or download the Media Creation Tool.
  • Enough free space on the system drive for repair operations and any pending updates.
  • Your data backed up if you reach the reset steps, since those remove apps and settings.

Step-by-Step

  1. Confirm what is actually failing. Press Win + R, type cmd and press Enter. If a window flashes and vanishes, the launched program is broken. If nothing at all happens, the shortcut path is wrong. If an error text appears, note the exact wording, because it tells you which repair to use. Menu and button labels in Windows 11 can differ slightly by version, device and region, so read for a close match rather than an exact one.
  2. Use Windows Terminal instead. Right-click Start and choose Terminal or Terminal (Admin). Terminal contains a Command Prompt profile, so you get the same shell with a better host. If this works, the command line itself is fine and only the legacy console host is damaged.
  3. Set Command Prompt as the default profile. Open Windows Terminal, click the arrow beside the tab bar to open the profile list, go to Settings, and look for the section that sets the default profile. Choose Command Prompt or Windows PowerShell (Admin) as needed. If you never need Terminal's other shells, this makes Win + X behave the way you expect again.
  4. Change the Terminal setting that hijacks cmd. In Terminal's Settings, find the Startup section and the option that makes Terminal the default terminal application. Switching it to Windows Console Host restores the classic cmd window. This single toggle fixes the most common complaint, which is that typing cmd opens Terminal instead.
  5. Restart the PC properly. Use Start, then the power button, then Restart, not Shut down. Fast Startup can carry a broken session across a shutdown, and a full restart clears pending file locks that stop cmd.exe from loading.
  6. Run Windows Security. Open Windows Security, choose Virus & threat protection, then Quick scan. Malware that hooks the shell is an uncommon but real cause of a command line that will not open.
  7. Repair system files. Open Terminal (Admin) and run DISM /Online /Cleanup-Image /RestoreHealth, then sfc /scannow. DISM repairs the component store, and SFC then uses that healthy store to replace damaged system files. Wait for both to finish; they can take several minutes.
  8. Check the environment path. Press Win + R, type sysdm.cpl, press Enter, and open the Advanced tab. Click Environment Variables and inspect the Path entry under System variables. It must contain C:\Windows\System32, otherwise cmd in the Run box cannot be found. Use Edit, then New, to add the missing entry exactly.
  9. Test with the full path. Press Win + R and type C:\Windows\System32\cmd.exe. If that opens but plain cmd does not, the problem is the path entry from step 8, not the program.
  10. Re-register the app through Settings. Go to Settings > Apps > Installed apps, find Terminal, and choose Advanced options followed by Repair. Repair is non-destructive and rebuilds app registration. Reset is the next step up and clears the app's saved preferences, so you will lose your Terminal profiles and colour settings.
  11. Install pending updates. Go to Settings > Windows Update and install everything offered, then restart. Broken shell components are often fixed by cumulative updates.
  12. Create a new local administrator account as a test. In Settings > Accounts, add a local admin account and sign in. If cmd works there, your user profile is damaged. Copy your files out with File Explorer first, then move permanently to the new profile rather than fighting the old one.
  13. Last resort: reset Windows. Go to Settings > System > Recovery and choose Reset this PC, keeping your files where possible. This removes installed apps and settings, so back up documents, browser profiles and licence keys first. It is worth trying only after everything above has failed.

Common Mistakes

  • Running repair commands in a normal window. DISM and SFC need an elevated terminal or they silently do little; always pick the Admin option.
  • Confusing Shut down with Restart. Shut down with Fast Startup enabled is closer to hibernate than to a clean boot.
  • Editing the Path variable by replacing the whole value instead of adding one entry. That breaks other programs, and you will notice only later when something else stops working.
  • Assuming every shell problem is malware, then wiping the machine before trying file repair and a new profile test.
  • Trying to delete or rename folders inside C:\Windows\System32 by hand. Use the built-in repair tools instead, because manual edits there frequently make the system unbootable.

Tips

  • Keep Terminal as your everyday tool. Its tabs, copy and paste handling and scrollback are better than the old console, and the Command Prompt profile behaves exactly like cmd.
  • Save a shortcut to C:\Windows\System32\cmd.exe on the desktop. It bypasses a damaged Start menu entry and the Run box entirely.
  • If only certain commands fail, such as administrator-level ones, the shell is fine and the issue is permissions; the fix is an elevated window, not a repair.
  • Write down any error text before troubleshooting. It shortens diagnosis considerably and lets you search the exact wording.

Troubleshooting

If Terminal opens but commands immediately close, type cmd /k at the prompt to keep the window alive after the command finishes. If you get a policy message saying the app has been blocked or disabled, open Settings > Privacy & security > App & browser control and look for the reputation-based protection options; a blocked app can usually be allowed there without disabling protection globally.

If DISM reports it cannot find the source files, check that the PC is online and try again, because RestoreHealth downloads replacements from Windows Update. If SFC finishes and reports it could not fix some files, look at the CBS log in C:\Windows\Logs\CBS for the file names, then repeat the DISM and SFC pair once; two clean passes are a good sign.

If nothing works and the machine is a managed work or school device, stop and contact the IT administrator. Group Policy can block command line access by design, and no local setting will override it.

Frequently Asked Questions

Why does typing cmd open Windows Terminal in Windows 11?

Windows 11 sets Terminal as the default console host, so legacy shortcuts are redirected to it. Terminal's Command Prompt profile runs the same shell; change the default terminal application in Terminal's settings if you prefer the old window.

Is Command Prompt removed from Windows 11?

No. cmd.exe is still part of Windows, and Windows Terminal simply became the host window that displays it. You can still launch cmd.exe directly from System32.

Will repairing or resetting Terminal delete my files?

No. Repair and reset affect only the Terminal app and its preferences. Resetting does clear your saved profiles and appearance settings, but documents are untouched. Resetting the whole PC is different and does remove apps and settings.

Can I use PowerShell for the same tasks?

For most everyday work yes, and many commands carry over. Older batch scripts and tools that depend on classic syntax are safer in the Command Prompt profile inside Terminal.

Why does cmd close instantly after I open it?

Something in your startup configuration is failing, or the console host is damaged. Start with an elevated terminal, run SFC, and test a fresh local admin account to rule out a corrupted user profile.