Method 3 – Changing the Registry File to stop the command prompt from closingĪfter applying this method, it ensures that the command prompt will never close immediately after the batch script file is executed every time and the user need not edit the batch file for adding either pause or cmd /k. Step 8: This is how you can stop the command prompt from closing but you need to add either Pause or cmd /k to all the batch files that you are running. Step 7: You can see that after running the batch file, the command prompt will not get closed and also allow the users to execute any other command as shown in the image below. Step 6: Now you can run the batch file by double-clicking on it. Step 5: Now save the file by going to the File option on the top menu and clicking Save from the list as shown below. Step 4: Once it opens up, type cmd /k at the end of the batch script file as shown below. Step 3: If there is no default text editor set on the system, then it will prompt you to select any editor installed like notepad. Step 2: Then click Edit from the menu as shown. Step 1: Right-click on the batch file and you should select Show more options from its context menu as shown below. The user has to only add cmd /k at the end which will be explained using the steps below. If any user wants to not only stop closing the command prompt window after executing a batch file but also to run some other commands, then this method is good to try. Method 2 – Add cmd /k at the end of the batch file Step 7: Now you can see that the batch script has been executed and the command prompt window is still open with the message saying “ Press any key to continue. Step 6: Next, double-click on the batch file or right-click on it and select Open to run this batch file. Step 5: Type pause at the end of the script as a final line and save the file by pressing CTRL + S keys together on the keyboard. Step 4: This will open the batch file in a Notepad or any other text editor app which is set as default. Step 3: Then click Edit on top of the context menu as shown in the screenshot below. Step 2: Right-click on the batch file and click Show more options from the context menu. Step 1: Go to the folder where the batch file is present. This makes the command prompt pause after the execution of the batch file till the user presses any key and closes as soon as a key is pressed.įollow the steps given below on how to do it. One of the ways with which the user can stop the command prompt from closing is to add a word called Pause at the end of the script file. Method 1 – By Adding PAUSE to the batch script file Method 3 – Changing the Registry File to stop the command prompt from closing.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |