banner



How To Keep A Cmd Window From Closing

When we execute a batch file, the Command Prompt opens and closes automatically afterward processing the batch file. Sometimes, the command is executed so quickly that information technology seems similar the Command Prompt closes immediately afterward opening the batch (BAT) file. This prevents users from performing other tasks after the execution of the batch file or viewing the condition of the commands they executed in the CMD. If y'all want the Command prompt window to remain open after processing the batch file, this post may help you.

Command Prompt closes opening batch file

Command prompt closes immediately later on opening batch file

You can prevent Command Prompt from closing immediately afterward opening a batch file in the following 3 means:

  1. By using the Suspension command.
  2. By using the cmd /thou command.
  3. Past editing the Registry keys.

Allow's see these methods i by one.

1] Prevent Command Prompt from closing immediately by using the Intermission command

The Pause command prevents the Command Prompt from closing after processing the batch file.

use Pause command in cmd

Follow the steps beneath:

  1. Correct-click on the batch file and select Edit. This will open up the Notepad.
  2. Type Pause at the terminate of the control that you have typed in the batch file.
  3. Relieve the file.

Now, when you open the batch file, the Command Prompt volition not close automatically later processing the file. Instead, it will display a message "Press any key to continue…" When yous press any key, the Command Prompt volition close.

The Suspension command will only let you lot see how the commands are executed. If y'all want the Command Prompt to remain open so that you can execute other commands on the same window, you take to utilize the next method.

2] Prevent Command Prompt from endmost by using the cmd /k control

prevent cmd from closing

The cmd /chiliad command lets yous execute new commands after the processing of the batch file without closing the Command Prompt. Right-click on the batch file and type cmd /yard at the cease of the batch file. After that, save it.

3] Editing the Registry key to stop Command Prompt from closing

The above two methods stop Command Prompt from closing immediately after processing the batch file. Simply the only downside of these two methods is y'all have to employ those commands in every batch file. If you already have many batch files, you have to edit all of them.

prevent cmd from closing using regedit

Yous can skip editing the batch files by modifying the Registry keys. We have explained the process below. Before you proceed, we recommend you create a fill-in of Registry.

1] Launch the Run command box. Type regedit and click OK. Click Yes if yous get a UAC prompt.

2] In the Registry Editor, navigate to the following paths:

HKEY_CLASSES_ROOT\batfile\shell\open\command  HKEY_CLASSES_ROOT\cmdfile\beat\open\control

You will find a "(Default)" value on the right side. Double click on that value and change its Value data to cmd.exe /1000 "%1" %*. Click OK to save the changes you fabricated. Close the Registry Editor when you are done.

If afterward trying the above iii methods, the Control prompt is yet closing automatically on your system, nosotros suggest yous endeavour the post-obit fixes:

  1. Run SFC scan.
  2. Troubleshoot in a clean kicking state.
  3. Reset your PC.

1] Run SFC browse

The Arrangement File Checker (SFC) is a utility from Microsoft that scans the system files for errors or corruptions and repairs the corrupted files. The consequence that you are experiencing may exist due to corrupted system files. Hence, running an SFC scan may ready the trouble.

2] Troubleshoot in a make clean boot state

Sometimes, a faulty program creates several bug on a Windows PC. Y'all can identify the faulty program or software by troubleshooting in a clean boot state. If you lot notice a programme the culprit of the problem, consider uninstalling it.

iii] Reset your PC

If nothing helps you lot set the error, consider resetting your PC.

Hope this helps.

How exercise I run an EXE from Command Prompt?

To run an EXE from Command Prompt, follow the steps below:

1] Launch the Command Prompt.

2] Type cd "file path" without quotations and hit Enter. The file path is the installation location of the EXE file. To know the file location, correct-click on the shortcut icon of the program that you want to open via CMD and select Open file location. Now, click on the accost bar of the File Explorer and re-create the unabridged path. You tin paste this unabridged path directly in the Command Prompt past using the Ctrl + Five keys.

3] Now, type start "filename.exe" without quotations and printing Enter.

This volition launch the EXE file.

How do I continue a control window open in a batch file?

You can use either Pause or cmd /thou commands to keep the command window open in a batch file. If y'all want, you lot can besides make this activeness permanent by modifying some keys in the Registry. We have explained all these three methods above in this article.

Related: Command Prompt cmd.exe keeps popping upwards on Startup.

Command Prompt closes opening batch file

Source: https://www.thewindowsclub.com/command-prompt-closes-immediately-after-opening-batch-file

Posted by: newsomecooncers.blogspot.com

0 Response to "How To Keep A Cmd Window From Closing"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel