Command Prompt Pops Up and Closes on Windows 11? Here’s How to FIX It

There’s a weird issue right now on Windows 11 where users are reporting that they constantly see a Command Prompt window briefly flashing on screen before closing again. Other users are reporting that the same behavior occurs when attempting to use the Command Prompt utility – the CMD window opens for a second or so before closing again.

CMD briefly flashes before closing on Windows 11

After investigating this issue thoroughly on Windows 11, it turns out that there are multiple causes that are known to trigger this behavior. Here’s a list of potential culprits that you’ll need to investigate:

  • Badly Migrated task – If you recently upgraded to Windows 11 from an older Windows version, chances are you’re experiencing this issue due to a badly migrated task that no longer serves a purpose on the new OS. To fix the issue in this case, you’ll need to run a deep DISM repair procedure and make sure that you’re also using the component cleanup feature to resolve the problem.
  • Missing Environment Variable Path – Another issue that’s specific to users that upgraded instead of clean installed Windows 11 is a situation in which a key environment variable is missing and you see the CMD prompt every time the system looks to use the environment variable. In this case, you can fix the issue by adding the environment variable via the System Properties screen.
  • Corrupted Background task belonging to the Office suite – If you have the Office suite installed (not individual Office Programs), another potential culprit that might cause this behavior on Windows 11 is a corrupted background task that is programmed to run every 10 minutes. Since it’s in no way essential to the Office suite, you can simply disable it via Task Scheduler to take care of the issue in this case.
  • Malware infection – There are certain variants of the browser hijacker (mainly present on Chrome and Firefox) that are known to cause this behavior while your browser is open. If you notice that this behavior is occurring only when you have your browser open, you should deploy a deep Malwarebytes scan to ensure that your Windows 11 computer is not infected.
  • Crypto-mining AUTORUN key – Keep in mind that there is a certain pseudo-virus called Soundmixer that is known to cause this behavior. Since this pseudo-virus lives in a grey legal area, most AV suites won’t pick up on it, so you’ll need to get rid of it yourself by searching for the main AUTORUN key via Registry Editor.
  • Different 3rd party processes – New ‘crypto-mining scams’ are created daily, so you should expect to deal with a new kind of virus that is not yet recognized by AV suites. In this case, you can identify the culprit and deal with it by using Task Scheduler in combination with Process Monitor to identify and deal with the threat causing the CMD window.

Now that you are aware of every potential cause of this issue, start following the instructions below for a series of fixes that other affected users have successfully used to get to the bottom of this issue and prevent the CMD window from popping up randomly on the screen.

Run a Deep DISM Repair procedure

If you recently migrated over to Windows 11 from an older Windows version, it’s not uncommon to face this issue due to a migrated background task that has no utility on the new OS.

Most likely, your computer keeps running it as it’s configured to be, but there’s no utility for it anymore so you’re just seeing a brief flash of a CMD window before the task is terminated.

In case this is the source behind your issue, you can resolve the issue entirely by running a specialized DISM scan that’s also capable of doing a component cleanup (on top of replacing file corruption).

However, you’ll need to deploy a DISM scan from a Windows Terminal window (since the CMD window might terminate before you get the chance to use it).

Follow the instructions below for a step-by-step of running a DISM scan with a component cleanup attribute on Windows 11:

  1. Press Windows key + R to open up a Run dialog box. Next, type ‘wt’ inside the text box and press Ctrl + Shift + Enter to open up a Windows Terminal window with administrative privileges.
    Windows 11 Command Prompt pops up
  2. When you’re prompted by the User Account Control window, click Yes to grant administrative privileges.
  3. Once you’re inside the elevated Windows Terminal prompt, type the following commands in order and press Enter after each one to initiate a DISM scan with restore health and component cleanup attributes:
    DISM.exe /Online /Cleanup-image /Scanhealth
    DISM.exe /Online /Cleanup-image /Restorehealth
    DISM.exe /online /cleanup-image /startcomponentcleanup
  4. After the operation is complete, reboot your Windows 11 PC one final time and see if the problem is fixed once the next startup is complete.

In case you’re still noticing the CMD window popping up during random intervals, move down to the next fix below.

Add the missing Environment Variable path

As it turns out, another fairly common reason that will prompt your Windows 11 installation to trigger blank CMD prompts during random intervals is a situation in which the ENvironment variable is missing a PATH (C:\Windows\SysWow64\).

If you find yourself in this particular scenario, you should be able to resolve the issue by accessing the System Properties screen and ensure that the Environment Variable path is present and correctly configured.

For instructions on how to do this on Windows 11, follow the instructions below:

  1. Open up a Run dialog box by pressing Windows key + R. When prompted by the Run box, type ‘sysdm.cpl’ and press Enter to open up the System Properties screen.
    Opening up the System Properties screen
  2. Once you’re inside the System Properties window, click on Advanced using the ribbon menu at the top.
    Accessing the Advanced menu of System Properties
  3. Inside the Advanced tab, go to the bottom of the screen and click on Environment Variables button.
  4. Once you’re inside the Environment Variables window, go under System variables and click on Path to select it, then click on Edit from below.
    Editing the variable path
  5. Inside the Edit environment variable window, click on the New button to create a new entry, then add C:\Windows\SysWow64\ as the new environment variable and click Ok to save the changes.
    Adding a new Environment Variable on Windows 11
  6. Once this change has been enforced, you can reboot your Windows 11 PC and see if the problem is fixed once the next startup is complete.

In case you’re still noticing the same kind of brief appearances of the CMD prompts, move down to the next method below for a more thorough way of investigating and figuring out which component is causing the issue.

Disable Office Background Task (if applicable)

Another fairly common culprit that might cause these annoying brief CMD pop-ups is a background task scheduler task belonging to the Office installation (OfficeBackgroundTaskHandlerRegistration).

This is actually an issue that was carried over to Windows 11 from previous Windows versions. Fortunately, the fix on Windows 11 is still the same – you’ll need to take a trip into Task Scheduler and disable the OfficeBackgroundTaskHandlerRegistration task from the cluster of tasks under Office.

If you’re looking for instructions on how to take care of this Office-induced issue, follow the steps below:

  1. Press Windows key + R to open up a Run dialog box. Next, type ‘taskschd.msc’ inside the text box and press Enter to open up the Task Scheduler utility.
    Opening up Task Scheduler

    Note: If you’re prompted by the User Account Control window, click Yes to grant admin access.

  2. Once you’re inside the Task Scheduler utility, use the menu on the left to navigate to the following location:
    Task Scheduler (Local) > Microsoft > Office
  3. With the Office folder selected, move over to the right-hand section and look for the task named OfficeBackgroundTaskHandlerRegistration.
  4. Next, right-click on OfficeBackgroundTaskHandlerRegistration and click on Disable from the context menu that just appeared.
    Disable the Office Background Task Scheduler task
  5. Once this modification has been enforced, reboot your PC and see if the problem is now fixed.

If this scenario is not applicable in your case or you already tried this fix with no success, move down to the next potential fix below.

Deploy a Malware Scan

In case the potential fixes above didn’t work in your case, you should start considering the possibility of some kind of malware that tried to utilize your system resources without your permission.

This is a known behavior exhibited by some browser hijackers – some of them even manage to escape regular scans performed by Windows Defender.

With this in mind, our recommendation is to perform a deep Malwarebytes scan to ensure that your system is not getting exploited by an outside attacker.

Deep Malwarebytes scan

Note: There are other alternatives that will help you do this, the vast majority of them are paid (or include a free alternative that is not as efficient).

Upon completing the Malwarebytes scan, reboot your computer and monitor the situation closely to see if the same random occurrences of CMD windows are still appearing.

If the problem is still not fixed on Windows 11, move down to the next potential fix below.

Delete the Crypto-Mining AutorRun key (if applicable)

Keep in mind that there’s one particular security threat that still manages to escape the vast majority of regular AV scans. It manages to do this because it lives in a gray area where most antivirus suites won’t label it as a security threat.

It’s called SoundMixer and it’s essentially a collection of reg keys that will trick your computer into mining crypto-currencies for an external user without your knowing.

In this case, the brief CMD display that you see from time to time is actually a CMD task that calls the mining process into action. This particular issue is often associated with a higher than usual usage of the CPU and GPU.

If this scenario is applicable, you should be able to fix the issue by using Registry Editor to find every registry value of SoundMixer and remove it from your computer in order to prevent your Windows 11 PC from being used for cryptocurrency mining (without your consent)

Follow the instructions below for step-by-step instructions to make sure that’s not the case:

Note: Keep in mind that this method is also effective in those situations where the CMD doesn’t open at all.

  1. Press Windows key + R to open up a Run dialog box. Next, type ‘regedit’ inside the text box and press Ctrl + Shift + Enter to open up Registry Editor with admin access.
    Opening up the Registry Editor
  2. When you’re prompted by the User Account Control (UAC), click Yes to grant admin access.
  3. Once you’re inside the Registry Editor, use the ribbon menu at the top to click on Edit, then click on Find from the context menu that just appeared.
    Using the search functionality on Registry Editor

    Note: This ‘virus’ doesn’t have a fixed location – this is why it’s necessary to find it using the search functionality on Registry Editor.

  4. Inside the Find window, type ‘SOUNDMIXER’ inside the Find What box, then check the boxes associated with Keys, Values, and Data are all checked before unchecking the Match whole string only box before clicking Fine Next.
    Finding the Sound Mixer
  5. Wait until your Registry is searched. If you get a hit, move over to the right-hand section of the screen, right-click on AutoRun and choose Delete from the context menu.
    Delete Autorun key from the list of results
  6. Next, click on Find Next once again and see if the AutoRun file is found somewhere else.
  7. If any AUTORUN mentions of the SoundMixer have been removed, reboot your computer and monitor the situation to see if you still see the same CMD prompt on Windows 11.

In case this method has not resolved the issue in your case, move down to the next potential fix below.

Investigate in Task Scheduler or Process Monitor

If none of the methods so far have allowed you to resolve the instances where CMD briefly appears on screen, you should start by performing an investigation among your tasks and processes that have the potential of causing this issue.

Potential causes that might cause this issue range from remnants of a browser hijacker to a previously established recurring task that no longer has a utility.

To cover all potential scenarios, our recommendation is to check bot Task Scheduler and run Process Monitor to rule out any potential culprit from your list.

Follow the next sub-guides below in whichever order to check either any item is currently configured to run during fixed intervals and it causes the CMD screen flash:

Check using Task Scheduler

Task Scheduler already comes pre-installed with Windows 11 (on every available version), so all you need to do is open it and follow the instructions below to check if any of the previously configured tasks are actually causing this issue:

  1. Press Windows key + R to open up a Run dialog box. Next, type ‘taskschd.msc’ inside the text box and press Enter to open up Task Scheduler.
    Opening up Task Scheduler
  2. If you’re prompted by the User Account Control (UAC), click Yes to grant admin access.
    Note: If the UAC prompt doesn’t appear, skip this step altogether.
  3. Next, use the menu on the left to select Task Scheduler Library, then move over to the right-hand section and see if any of the items are scheduled to run every 10 minutes or so by looking at the Triggers section.
    Investigating for suspicious tasks

    Note: If no suspicious activity is found, you should also investigate the scheduled tasks related to Office, Mozilla, and other 3rd party services.

  4. If you discover any suspicious task with a recurring trigger that opens up a CMD prompt, right-click and choose Disable from the context menu.
    Disable the Scheduled Task
  5. Reboot your PC and see if the problem is now fixed.

Check using Process Monitor

Process monitor is a free advanced monitoring tool for Windows computers that’s not built-in into Windows 11. It will allow you to filter all the system processes that are recurringly called into action – this will allow you to discover your culprit.

Follow the instructions below to download, install and use Process Monitor to discover which process is causing the blank CMD prompt to appear regularly:

  1. First things first, access the download page of Process Monitor from any website and click on Download Process Monitor to download it locally.
    Downloading the Process Monitor utility
  2. Once the ZIP archive is downloaded locally, extract its contents to a local folder and double-click on Procmon.exe to launch the utility.
    Extracting the contents of Process Monitor
  3. When you’re prompted by the User Account Control window, click on Agree to accept the terms of licensing.
  4. At the user Account Control, click Yes to grant admin access.
  5. Once the utility is finally opened, wait until all the processes and events are loaded – look at the bottom of the screen to check up on the process.
    Waiting until Process Monitor does his thing
  6. Next, click on Filter from the menu at the top, then click on Filter from the context menu that just appeared.
    Accessing the Filter menu
  7. Inside the Process Monitor Filter window, change the first drop-down menu to Operation, the second to ‘is’ the third to ‘Process Create’ , and the fourth to ‘include’ before clicking on Add to filter the processes accordingly.
    Configuring the Process Monitor filters
  8. Click Ok to enforce the current filtering then click YES at the next prompt.
  9. Wait until the event is initialized and leave the utility open to scan for processes that are currently exhibiting this behavior.
  10. After a few minutes, return to this window and see if any culprits are discovered.
    Checking for potential culprits that might cause the issue on Windows 11
Kamil Anwar
Kamil is a certified MCITP, CCNA (W), CCNA (S) and a former British Computer Society Member with over 9 years of experience Configuring, Deploying and Managing Switches, Firewalls and Domain Controllers also an old-school still active on FreeNode.

Expert Tip

Command Prompt Pops Up and Closes on Windows 11? Here’s How to FIX It

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested