Command Prompt Pops Up and Closes in Windows 11? | Fix It Now

Ariel Mu
5 min readOct 22, 2021

Since the release of Windows 11, many users encounter various issues like Valorant FPS drops, Windows hello not working, screen flickering, and the one discussed here. Why Command Prompt pops up and closes on Windows 11? According to a survey, the issue is often related to missing Environment Variable path. Besides, other factors like badly migrated tasks, conflicting background Office tasks, crypto-mining AutoRun key, and even malware infection are responsible for the problem. Luckily, there are several effective troubleshooting methods.

Fix 1. Perform a DISM Repair

If you recently upgraded to Windows 11 from an older version like Windows 10, you may encounter some issues because there’s no utility in the new OS to run migrated background tasks. In this case, you can try performing a DISM repair to clean any unwanted tasks.

Step 1. Press Win + R keys to open the Run box, and then type wt in it and press Ctrl + Shift + Enter to access the Windows Terminal window with admin rights.

Step 2. Click on Yes in the User Account Control window to confirm it.

Step 3. In the elevated Windows Terminal window, type the following command in order and hit Enter after each one to execute the DISM scan.

  • DISM.exe /Online /Cleanup-image /Scanhealth
  • DISM.exe /Online /Cleanup-image /Restorehealth
  • DISM.exe /online /cleanup-image /startcomponentcleanup

Once done, reboot your computer and check if the Command Prompt opens and closes in Windows 11.

Fix 2. Manually Add the Missing Environment Variable Path

Another command reason for Command Prompt pops up and closes in Windows 11 is due to the Environment variable path being missing or configured improperly. Here you can follow the steps below to add the missing Environment variable path manually.

Step 4. In the pop-up window, click on New to create a new entry, and then name it C:\Windows\SysWow64\ and add it as the new Environment Variable path.

Step 5. Click on OK to save changes.

Now, restart your computer and see if the Command Prompt opening up and closing automatically Windows 11 issue gets solved.

Fix 3. Disable Any Office Tasks

Some users reported that the Command Prompt flashes and closes Windows 11 when a background task belonging to the Office suite is running. If this situation applies to you, you can fix the issue simply by disabling the Office background task.

Step 2. In the Task Scheduler window, go to the Task Scheduler Library > Microsoft > Office path.

Step 3. Find the task named OfficeBackgroundTaskHandlerRegistration from the right pane, and then right-click it and select Disable.

Once completes, reboot your computer and check if the Command Prompt pops up and closes in Windows 11.

Fix 4. Run a Full Virus Scan

As mentioned above, the virus or malware infection is responsible for the Command Prompt pops up and closes on Windows 11. To exclude this factor, we highly recommend you perform a full scan of your system. For that:

Step 1. Press Win + I keys to open the Settings Windows,and then go to Privacy & security > Windows Security > Virus & threat protection.

Fix 5. Remove the Crypto-Mining AutorRun Registry key

It’s known that there is a particular security threat called SoundMixer that still can escape the vast majority of antivirus scans. To prevent Windows 11 from opening Command Prompt automatically or occurring some other issues, you can remove every registry key of the SoundMixer in Registry Editor.

Step 1. In the Run dialog box, type regedit and hit Ctrl + Shift + Enter to access the Registry Editor with admin right. Then click on Yes when you are prompted by the User Account Control access.

Step 3. Type SOUNDMIXER in the Find What box, and make sure that the Keys, Values, and Data are all checked and click on Find Next.

Once removed, restart your computer and see if the Command Prompt pops up and closes in Windows 11.

Fix 6. Use the Task Scheduler

If all the above methods fail to fix the “Command Prompt opens and closes in Windows 11” issue, you can try using the Task Scheduler to investigate your tasks and processes that could be the potential causes. Here’s how:

Step 2. Select Task Scheduler Library from the left-hand pane, and then check if any tasks are scheduled to run every 10 minutes from the right side or look at the Trigger section.

Step 3. If you find any suspicious tasks with a recurring trigger that opens up Command Prompt, right-click it and select Disabled. Here you should investigate the tasks mainly related to Office, Mozilla, and other third-party programs.


Position: Columnist

Ariel is an enthusiastic IT columnist focusing on partition management, data recovery, and Windows issues. She has helped users fix various problems like PS4 corrupted disk, unexpected store exception error, the green screen of death error, etc. If you are searching for methods to optimize your storage device and restore lost data from different storage devices, then Ariel can provide reliable solutions for these issues.

Originally published at on October 22, 2021.