You open Command Prompt to run a repair command, and the black window flashes on screen and disappears. When Windows 10 Command Prompt closes immediately, many troubleshooting dewaasia guides become impossible to follow.
There are two very different situations. In one, you are running a batch file or command that finishes quickly, so the window closes because its work is done. In the other, Command Prompt itself crashes or is closed by something else as soon as it opens.
The second case is often caused by a leftover AutoRun setting, a damaged system file, or malware that blocks command tools.
Testing how you open the window shows which case applies.
The issue often appears when following repair guides, where a command needs to be typed into a window that refuses to stay open.
Possible Causes
Command Prompt closes straight away for these reasons:
- A batch file or command finished and the window closed normally.
- An AutoRun registry entry runs a command that exits immediately.
- Command Prompt is blocked by policy or malware.
- The cmd.exe file or related system files are damaged.
If Command Prompt stays open when started from the Run box but closes when you double-click a script, the script is simply finishing.
Quick Fixes to Try First
Test different ways of opening it.
- Press Windows + R, type cmd, and press Enter.
- Right-click Start and choose Windows PowerShell, which works as an alternative for most commands.
- If you are running a .bat file, open Command Prompt first, then type the script’s path, so the window stays open to show the results.
- Add the word pause at the end of your batch file to keep its window open.
- Restart the PC and try again.
If cmd opens normally from the Run box, the problem lies with the shortcut or script.
PowerShell accepts almost every command used in common repair guides, including sfc and DISM, so it is a practical alternative while you investigate.
Advanced Steps for Stubborn Cases
Check AutoRun and system files.
- Open Registry Editor and look at HKEY_CURRENT_USER\Software\Microsoft\Command Processor and HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor.
- If an AutoRun value exists, export the key, then delete AutoRun.
- Open PowerShell as administrator and run sfc /scannow.
- Run a full malware scan with Windows Security.
- Check whether a policy disables the command prompt, especially on work PCs.
Before You Go Further: Keep Your Files Safe
Back up the registry before changes. Do not run unknown batch files.
Conclusion
Command Prompt closing instantly is either normal script behaviour or a blocking problem. Test from Run, check AutoRun entries, and repair system files.
If command tools are blocked along with Task Manager and Registry Editor, treat it as a sign of possible malware and scan the PC thoroughly.
