Fix Command Prompt Not Working: Step-by-Step
In this article
If Command Prompt won't open, crashes immediately, or shows errors, the fix usually involves repairing system files, checking environment variables, or resetting the app. Below are proven steps to get it working again. You'll need administrator access for most fixes.
What You'll Need
- Windows 10 or 11 PC
- Administrator account (to run some commands)
- Internet connection (for system file repair via Windows Update)
Step-by-Step
- Try opening Command Prompt via alternate methods. Sometimes the shortcut is broken. Press Windows + R, type
cmd, and press Enter. If that works, the issue is with the Start menu shortcut. If not, try opening from Task Manager (Ctrl+Shift+Esc > File > Run new task > typecmd). - Run the System File Checker (SFC). This scans for corrupted system files. Open an elevated Command Prompt (if possible) by right-clicking the Start button and selecting "Command Prompt (Admin)" or "Windows Terminal (Admin)". If you can't open Command Prompt at all, use the alternate methods in step 1 to get an admin prompt. Then type:
sfc /scannowand press Enter. Wait for the scan to complete (may take 10-15 minutes). - Run DISM to repair the system image. If SFC found issues or couldn't run, use DISM. In the same admin prompt, type:
DISM /Online /Cleanup-Image /RestoreHealthand press Enter. This may take up to 30 minutes. After it finishes, restart your PC and run SFC again if needed. - Check the PATH environment variable. If Command Prompt opens but says "'cmd' is not recognized", the PATH variable is broken. Open File Explorer, right-click "This PC" > Properties > Advanced system settings > Environment Variables. Under System variables, find "Path", click Edit. Ensure
%SystemRoot%\system32is listed. If not, click New and add it. Click OK and restart. - Reset the Command Prompt app (Windows 10/11). Go to Settings > Apps > Apps & features. Search for "Command Prompt". Click it and select "Advanced options". Click "Reset". This clears app data but does not affect your files. If you don't see it, skip to next step.
- Re-register the Windows Store app (if using Windows Terminal). If you're using Windows Terminal (the modern replacement), open PowerShell as admin (search "PowerShell", right-click, Run as administrator) and run:
Get-AppxPackage -Name Microsoft.WindowsTerminal | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}. Then restart. - Run a malware scan. Some malware can block Command Prompt. Use Windows Security (Settings > Privacy & Security > Windows Security > Virus & threat protection > Scan options > Full scan).
- Create a new user account. If Command Prompt works in another user account, your current profile is corrupted. Create a new local admin account (Settings > Accounts > Family & other users > Add someone else to this PC). Then log into that account and test.
Common Mistakes
- Running SFC without admin rights: SFC will fail with "You must be an administrator". Always right-click and run as administrator.
- Ignoring the DISM step: SFC often can't fix corrupted system files without DISM first. Run DISM before SFC if SFC fails.
- Editing PATH incorrectly: Removing existing entries can break other programs. Only add missing paths, don't delete anything unless you're sure.
- Forgetting to restart: Many fixes require a restart to take effect.
Tips
- Use Windows Terminal as a modern alternative—it includes Command Prompt and PowerShell in one app.
- If you frequently use Command Prompt, pin it to the taskbar for quick access.
- Keep Windows updated—system file corruption is often fixed by cumulative updates.
Troubleshooting
If the above steps didn't work, try these in order:
- Check if Command Prompt opens but immediately closes: Run it as administrator. If it flashes and closes, it might be a policy restriction. Open Group Policy Editor (gpedit.msc) and check User Configuration > Administrative Templates > System > "Prevent access to the command prompt". If it's enabled, set to Not Configured.
- Use Safe Mode: Boot into Safe Mode (Settings > System > Recovery > Advanced startup > Restart now, then Troubleshoot > Advanced options > Startup Settings > Restart > press 4). If Command Prompt works there, a third-party service is interfering.
- Perform a system restore: If you have a restore point before the issue, use System Restore (search "Create a restore point" > System Protection > System Restore). This won't affect personal files.
- Last resort—reset Windows: Go to Settings > System > Recovery > Reset PC. Choose "Keep my files" to preserve personal data, but this reinstalls Windows and removes installed apps. Back up important data first.
Frequently Asked Questions
Why does Command Prompt open and close immediately?
This often happens due to a corrupted system file or a policy that blocks it. Run SFC and DISM as described above, and check Group Policy settings.
Can I fix Command Prompt without admin rights?
No, most fixes require administrator privileges. If you don't have them, contact your system administrator.
Will resetting Command Prompt delete my files?
No, resetting the app only clears its settings and cache. It does not affect your personal files.
What if Command Prompt is not found in the Start menu?
Use Windows + R, type cmd, and press Enter. If that works, the Start menu shortcut is broken—you can pin it again by searching "Command Prompt" and selecting "Pin to Start".
Is Windows Terminal a replacement for Command Prompt?
Yes, Windows Terminal is the modern app that hosts Command Prompt, PowerShell, and other shells. If Command Prompt is broken, Windows Terminal often still works.
Can malware cause Command Prompt to stop working?
Yes, some malware disables Command Prompt to prevent removal. Run a full antivirus scan with Windows Security or a trusted third-party tool.