• Linkedin
  • Reddit

Summary :

Command Prompt pops up and closes in Windows 11

What can you do if Command Prompt pops up and closes in Windows 11? Now, you come to the right place. In this post, MiniTool Partition Wizard summarizes several effective and easy ways to fix the issue.

Quick Navigation :

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.

slow startup windows 11 thumbnail
How to Fix Slow Startup Windows 11? | 9 Simple Ways

Why is Windows 11 so slow? How to fix slow startup Windows 11? If you are still trying to figure them out, then this post is what you are looking for.

Read More

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

run a DISM scan in Windows 11

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 1. Open the Run box again, and then type sysdm.cpl in it and hit Enter.

Step 2. In the System Properties window, go to the Advanced tab and click on Environment Variables at the bottom.

click Environment Variables Windows 11

Step 3. Locate the System variables section, and then select Path from the list and click on Edit.

select Path from System variable Windows 11

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.

add a new Environmental Variable in Windows 11

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 1. Open the Run box, and then type taskschd.msc in it and hit Enter.

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.

disable Office Background task Windows 11

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.

click Virus and threat protection Windows 11

Step 2. Click on Scan options to access more scan options, and then select Full scan and tap on Scan now to start the full virus scan. Then you need to wait a while until the scan completes. After that, you can restart your system and see if the “Command Prompt opens and closes Windows 11” issue is fixed.

select Full scan Windows 11

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 2. In the Registry Editor window, click on Edit from the top ribbon menu and select Find.

select Find in Registry Editor Windows 11

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.

find SoundMixer in Registry Editor Windows 11

Step 4. Wait for the Registry Editor to complete the search. Once you find that, right-click on AutoRun from the right pane and select Delete. Then click on Yes to confirm the delete.

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 1. Open the Task Scheduler window like step 1 in Fix 3.

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.

night light not working windows 11 thumbnail
How to Fix Night Light Not Working in Windows 11? [7 Ways]

Have you come across the Night Light not working Windows 11 issue? If you are still trying to fix it, this post provides 7 effective troubleshooting methods.

Read More
  • Linkedin
  • Reddit

User Comments :