What if I tell you you can run multiple commands simultaneously in Command Prompt? You can run two commands in one line in Windows Command Prompt by creating a batch script file using Notepad. Below, we have shared the best methods for running multiple commands in CMD on Windows.
1. Run Multiple Commands By Creating a Batch Script
This method includes creating a batch script to run multiple commands. Using this, you can execute all your commands one by one automatically. For that, we are going to use the commands to reset the DNS cache of Windows-
- ipconfig /displaydns
- ipconfig /flushdns
- ipconfig /release
- ipconfig /renew
1. Open Notepad on your computer.
2. Enter the commands you want to execute with a single click. In this example, we use the four commands ment…
What if I tell you you can run multiple commands simultaneously in Command Prompt? You can run two commands in one line in Windows Command Prompt by creating a batch script file using Notepad. Below, we have shared the best methods for running multiple commands in CMD on Windows.
1. Run Multiple Commands By Creating a Batch Script
This method includes creating a batch script to run multiple commands. Using this, you can execute all your commands one by one automatically. For that, we are going to use the commands to reset the DNS cache of Windows-
- ipconfig /displaydns
- ipconfig /flushdns
- ipconfig /release
- ipconfig /renew
1. Open Notepad on your computer.
2. Enter the commands you want to execute with a single click. In this example, we use the four commands mentioned above.
3. Click on the file and select Save as.
4. Now save this file with the .bat extension. For example, DNSreset.bat
5. If you wish to reset the DNS cache, double-click on the batch script file.
2. Using Special Characters
This method will execute some special characters between the commands simultaneously.
1. If you want to run two or more commands simultaneously, just insert the** ‘&’** between the commands. For example – **ipconfig /flushdns & ipconfig /renew**
2. If you want to execute the second command after the success of the first command, then use the **&& **between the commands. For example – **ipconfig /flushdns && ipconfig /renew**
3. If you want to run the second command only if the first one fails to execute, enter || between the commands. For example – **ipconfig /flushdns || ipconfig /renew**
This article is about running** multiple commands in CMD on Windows**. I hope this article helped you! Please share it with your friends also. If you have any doubts, let us know in the comment box below.