

The bad sectors on your hard drive may be the cause of the issue. In order to fix the issue that CMD randomly opens, this article states 6 solutions. Let’s move to the following content to fix the annoying issue.

However, lots of Windows users said that their Command Prompt keeps popping up on Windows, according to the Microsoft community and Google search result. Thank you.Tip: Do you know how to use CMD to manage your hard drive, partition, and volume? There is an article What Command Can Be Used to Manage Hard Drives, Partitions, and Volumes? you can click to learn about how to do that. If you want to know anything else related to this, comment below. These all are easy and quick ways to keep your window of the Command Prompt open so that you can easily configure and watch each command which you run through the batch file or Powershell Script. Now run any command, the Command Prompt window will stay open as long as you will keep it open. This registry will save to your Registry Editor of Windows. Windows Registry Editor Version ”C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\” –noExit \ “& \\\ “%1\\\ “C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\ “ –NoExit \ “-Command\” \”if ( ( Get-ExecutionPolicy ) –ne ‘AllSigned’) & \\\ ”%1” \\\ “\””Īfter saving the file, double click on it. For this, type the following code in your Notepad and save the file with the. You can prevent Command Prompt window from closing after running commands through adding a Registry Key in the Windows Registry. You can easily see each command which had run on the result of bat file in CMD as long as you do not press any key. This will keep the Command Prompt window open until you do not press any key. Now add “PAUSE” word at the end of your bat file. The second way I am going to show you is also a simple method.Įdit your bat file by right clicking on it and select “Edit” from the list.

This is the very easy and handy way to prevent the Command Prompt window from closing after running commands.
