How to fix command prompt randomly opens and closes

Several users have claimed command prompt randomly opens and closes issue. This issue can happen only at the first login of Windows or it might happen randomly from time to time during the usage of the PC. It might also happen after a specific time, for instance after every hour or every 47 minutes.

Well there are numerous factors that can cause this. If the command prompt is popping up after a specific time then it may be because of the task scheduler. It can be also caused by a Windows Service trying to download something from the internet and failing thus, trying over and over again.

Why I am facing the above mention issue?

Reason 1: Corrupted System Files

Reason 2: Interference of the applications running in the background

Reason 3: Malware Attack

Reason 4: Automatic Maintenance

Try these fixes for Command Prompt randomly Opens and Closes

Method 1: Close Conflicting Background Apps

As we have earlier mentioned that you are likely to face the above mention error because of background applications. So it is suggested to disable the apps to resolve the issue.

Disable Firefox Browser

Step 1: Press Ctrl + Shift + Esc key to open the Task Manager and switch to the Startup tab> find and select the Firefox browser, right-click it and select Disable option from the expanded menu

Disable Office Components

Step 1: First of all type task scheduler under the taskbar search box to find and opens the application> find the OfficeBackgroundTaskHandler in the right window, then right-click it, and then disable the task in the expanded form.

Method 2: Create a Copy of CMD.exe and change the Name

In this method we suggest you to create a copy of cmd.exe and changing the name and to do the same follow the below mention guidelines:

Step 1: First of all open This PC on the desktop and go to Local Disk (C:) > Windows >System32. Then find the cmd.exe application, right-click it, select Copy in the expanded menu and paste in the original path to get a copy of cmd.exe

Step 2: Right-click on the copy of cmd.exe, then select Rename in the expanded menu, now rename it to something else. And then double-click to open the renamed copy of cmd.exe

Method 3: Use the CHKDSK/F Command

First of all use CHKDSK/F command to check and in order to fix errors on your PC.

Here’s how:

Step 1: First of all type in cmd in the search box on the taskbar and then click Run as Administrator option in the right window.

Step 2: After that type the following command under the command prompt window and press Enter to execute the command, and then press Y to confirm execution. Then Restart the PC and wait for the automatic repair.

CHKDSK /F

Method 4: Perform a Clean Boot

This method will start the Windows System with the fewest drivers which can eliminate the conflicts of third party to the greatest extent. To proceed with this method follow the below mention guidelines:

Step 1: First of all press Windows + R keys to open Run dialog box then type in msconfig and press Enter to open the system configuration

Step 2: Then switch to the Services tab, check the Hide all Microsoft Services checkbox, and click the Disable all button

Step 3: Switch to the Startup tab above and tap the Open Task Manager option

Step 4: Under the list of started up applications, select each item in turn, right-click and select Disable

Step 5: Once you have disabled all the applications, go back to System Configuration, click OK to save the changes and restart the PC

Method 5: Add System Environment Variable Path

Adding System Environment Variable Path is also a good pick to get the past above mention issue. To do the same follow the below mention guidelines:

Step 1: Type Environment Variables in the taskbar search box and then open System Properties. Under the Advanced tab click Environment Variables

Step 2: Select PATH in the Environment Variables window and tap the Edit button> Click the New button under the right sidebar, add C:\Windows\SysWow64\ and tap OK to save the changes

Method 6: Use Command Prompt to keep the CMD open

If you are still struggling with command prompt randomly opens and closes follow the below mention guidelines:

Step 1: Use the Windows + R keys to open the Run dialog box and type in cmd /k ipconfig /all and press Enter to execute this command.

Method 7: Delete the Auto Run key from the Registry

In this method we suggest you to delete the Auto Run key from the Registry. To do the same follow the below mention guidelines:

Step 1: Press Windows + R keys to open the Run dialog box and type regedit and press Enter to open the Registry Editor

Step 2: Then go to the one of the following two paths then find and delete the file named Auto Run in the right window:

HKEY_CURRENT_USER\Software\Microsoft\Command Processor

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor

Method 8: Run SFC

 Running the SFC is also a good choice to resolve such kinds of Windows issues, so in order to proceed with the method follow the below mention steps:

Step 1: Under the search box in the Taskbar you need to type cmd and click Run as an Administrator option in the right window

Step 2: After that type the following command in the command prompt window and press Enter key to execute the command. Then wait for the tool to scan and repair the corrupted files.

Sfc/scannow

Step 3: Then type the following commands one by one and don’t forget to press Enter key to execute the commands:

DISM.exe /Online /Cleanup-image /Scanhealth

DISM.exe /Online /Cleanup-image /Checkhealth

DISM.exe /Online /Cleanup-image /Restorehealth

Now wait till the process gets completed as it will take some time.

Alternatively, you can also go for an automatic PC Repair Tool to scan your repositories. This is an expert tool which will not only repair your system files but will also immune your system from other malfunctioning of Windows without any hassle.

⇑Get PC Repair Tool from Here⇓

That’s all about command prompt randomly opens and closes, we assume you liked the blog.

Sakshi Anant Author

Leave a Reply