Using Windows 11 computer is great fun when it comes to visual overhaul, improved stability, and performance all around. However, each and every Windows OS do come with a couple of new issues or bugs that plenty of users are facing whatsoever. Recently, some of the affected users are reporting that the Windows 11 Command Prompt Pops Up and Closes Randomly on their PCs which is quite unexpected. Are you one of them? Well, don’t worry.
Sometimes you may encounter unexpected pops up and closes of CMD (command prompt) window on the computer running on Windows 11 OS that may appear due to the conflict of the attached keyboard or mouse. In some scenarios, it may happen due to system-specific reasons too that can be considered as a bug. Luckily, here we’ve shared a couple of possible workarounds below that should help you out.
Also Read
How to Fix Runtime Error in Windows 11
Fix: Windows 11 Clipboard History Not Working
Fix: Miracast Not Working on Windows 11 and 10
How To Fix External Hard Drive I/O Device Error in Windows 11/10
How to Fix if 4K Videos Not Playing on Windows 11
Fix: Windows 11 Taskbar Not Hiding in Full Screen
How to Fix If Brightness Slider Missing on Windows 11 and 10
Fix: Windows 11 Command Prompt Pops Up and Closes Randomly
Sometimes missing environment variable paths, background office tasks, virus/malware, crypto mining processes, etc can cause such errors on the Windows 11 PC. So, it’s always better to fix such an issue manually by following the steps below.
1. Use DISM and SFC Command
Try using the Deployment Image Servicing and Management (DISM) command and SFC scan command on your Windows PC to fix several issues with the corrupted or missing files. DISM is a command-line tool that can be used to mount and service Windows images before deployment. To do so:
- Click on the Start Menu and type cmd.
- Now, right-click on Command Prompt from the search result.
- Select Run as administrator > If prompted, click on Yes to give admin privileges.
- Once the command prompt window opens, type the following command and hit Enter to execute it:
DISM.exe /Online /Cleanup-image /Scanhealth
- Then type the following command and hit Enter:
DISM.exe /Online /Cleanup-Image /CheckHealth
- Then type the following command and press Enter:
DISM.exe /Online /Cleanup-Image /RestoreHealth
- Now, wait for the process to complete and exit the command prompt.
- Finally, restart your computer to apply changes.

Deleting the following folder worked for me.
Using this app “Sysinternals Autoruns”
to find this app “Dllhost”.
In my pc that was in this path “C:\ProgramData\Dllhost” so I deleted and the task scheduler called “NvStray” folder which point to the same path “C:\ProgramData\Dllhost”
After that everythin worked perfectly