sodcalculator

10 Tech How-To

Fix Command Prompt Not Working on Windows 11

Guide 10-32741 · Updated · Step by step

If Command Prompt won’t open, crashes, or shows errors on Windows 11, the fix usually involves repairing system files, checking the PATH environment variable, or resetting the app. This guide walks through the most effective solutions, from quick checks to advanced repairs, so you can get back to typing commands.

Why Command Prompt Fails on Windows 11

Command Prompt (cmd.exe) is a core Windows component, but it can stop working due to several common causes:

  • Corrupted system files – damaged Windows system files can break cmd.exe.
  • Incorrect PATH variable – if the System PATH doesn’t include C:\Windows\System32, Windows can’t find cmd.exe.
  • Malware or third-party software – some programs modify command-line settings or block cmd.exe.
  • User profile issues – a corrupted user profile can prevent Command Prompt from launching.
  • Policy restrictions – Group Policy or registry settings may disable Command Prompt.

Identifying the exact cause is the first step, but you can often fix the problem by trying the solutions below in order.

Quick Checks Before Troubleshooting

Before diving into deeper repairs, try these simple steps:

  1. Restart your PC – a temporary glitch often resolves itself.
  2. Run as administrator – right-click the Start button and select “Terminal (Admin)” or “Command Prompt (Admin)”. If it opens that way, the issue is with your standard user permissions.
  3. Try Windows Terminal – Windows 11 uses Windows Terminal as the default host for Command Prompt. If cmd.exe itself works but Terminal doesn’t, the problem is with the Terminal app.
  4. Check if cmd.exe exists – open File Explorer and navigate to C:\Windows\System32\cmd.exe. If it’s missing, you’ll need to repair Windows.

If these don’t help, move on to the more thorough fixes.

Run the System File Checker (SFC) and DISM

Corrupted system files are a leading cause of Command Prompt failure. The System File Checker (SFC) scans and repairs protected system files. Since Command Prompt itself may not open, you’ll need to run these tools from Windows Recovery Environment (WinRE) or via Windows PowerShell.

  1. Right-click the Start button and select Windows Terminal (Admin) or PowerShell (Admin).
  2. Type sfc /scannow and press Enter. This will take several minutes.
  3. If SFC finds errors but can’t fix them, run DISM /Online /Cleanup-Image /RestoreHealth and then re-run SFC.
  4. Restart your PC and try opening Command Prompt again.

If you can’t open any command-line tool, boot into Windows Recovery Environment (Shift + Restart from the login screen), then go to Troubleshoot > Advanced Options > Command Prompt. From there, run the same commands.

Check and Repair the PATH Environment Variable

The PATH variable tells Windows where to look for executables. If C:\Windows\System32 is missing, Command Prompt won’t launch from the Start menu or Run dialog.

  1. Open Settings > System > About > Advanced system settings.
  2. Click Environment Variables.
  3. Under System variables, select Path and click Edit.
  4. Ensure C:\Windows\System32 is in the list. If not, click New and add it.
  5. Click OK and restart your PC.

If you see a suspicious entry pointing to a non-existent folder, remove it. Malware or poorly uninstalled software can corrupt the PATH.

Reset or Re-register the Windows Terminal App

Windows 11 uses Windows Terminal as the default host for Command Prompt. If Terminal is corrupted, Command Prompt might appear broken even though cmd.exe works.

  1. Open Settings > Apps > Installed apps.
  2. Search for Windows Terminal.
  3. Click the three-dot menu and select Advanced options.
  4. Click Reset (this will lose your Terminal settings).
  5. Alternatively, you can reinstall Terminal from the Microsoft Store.

After resetting, try opening Command Prompt from the Start menu again.

Use the Windows 11 Startup Repair

If the above fails, the issue might be deeper in the Windows boot configuration. Startup Repair can fix problems that prevent Windows from loading correctly, which may also affect Command Prompt.

  1. Restart your PC and press the power button repeatedly to trigger automatic repair, or boot from a Windows 11 installation USB.
  2. Choose Repair your computer.
  3. Select Troubleshoot > Advanced options > Startup Repair.
  4. Follow the on-screen instructions. This may take 15-30 minutes.

Startup Repair will check and fix boot-level issues that might be preventing Command Prompt from launching.

Create a New User Profile

If Command Prompt only fails for your user account, your profile may be corrupted. Creating a new user account and transferring your files is a reliable fix.

  1. Open Settings > Accounts > Other users.
  2. Click Add account and follow the prompts to create a new local user (you don’t need a Microsoft account).
  3. Log into the new account and test Command Prompt.
  4. If it works, copy your files from the old profile to the new one (Documents, Desktop, etc.).

This is a more drastic step, but it often resolves persistent profile-related issues.

Frequently Asked Questions

Why does Command Prompt open and close immediately?

This usually happens when a command or script in your AutoRun registry key causes an error. Open Registry Editor (regedit) and navigate to HKEY_CURRENT_USER\Software\Microsoft\Command Processor. Delete the AutoRun value if it exists. Also check the same key under HKEY_LOCAL_MACHINE.

Can I replace Command Prompt with PowerShell?

Yes, you can set PowerShell as the default terminal in Windows Terminal settings. However, some legacy scripts and commands only work in cmd.exe. It’s better to fix the underlying issue than to avoid it.

What if I get “Windows cannot find ‘cmd.exe’”?

This indicates the PATH variable is missing C:\Windows\System32 or the file is actually missing. Follow the PATH repair steps above. If the file is missing, run an in-place upgrade of Windows 11 using the Installation Assistant or a bootable USB.

Is it safe to run SFC and DISM?

Yes, these are built-in Windows tools designed to repair system files. They don’t touch your personal files. However, they can take time and may require a restart.

Will resetting Windows Terminal delete my settings?

Yes, the Reset option in Settings will remove your custom profiles and preferences. You can back up your settings by exporting your Windows Terminal settings.json file before resetting.

Can malware cause Command Prompt to fail?

Yes, some malware modifies the PATH or disables command-line tools to prevent removal. Run a full Windows Defender scan or a reputable third-party antivirus scan if you suspect malware.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →