In this particular case, the path to “C:\Windows\SysWow64” is usually missing, which causes the Command Prompt to spontaneously open and close. Add missing Environment Variable path manuallyĪs we mentioned earlier, users that have upgraded to Windows 11 can also experience missing Environment Variable paths. If it does, continue to perform the rest of the mitigation methods below. Once completed, spend some time on your computer to check if the Command Prompt still behaves the same. Do not close the Command Prompt and allow them ample time to run. It can take a few minutes for the commands to execute completely. To do so, launch Command Prompt with administrative privileges and enter the following 3 commands, one after the other: DISM.exe /Online /Cleanup-image /ScanhealthĭISM.exe /Online /Cleanup-image /CheckhealthĭISM.exe /Online /Cleanup-image /Restorehealth Repair Windows images using DISM This method will clear out any unwanted tasks that are of no use anymore.
You can try repairing your Windows image in case you upgraded to Windows 11 from an older OS. Fix Command Prompt randomly opens and closes in Windows 11 Repair Windows image