How to Run Multiple Commands in CMD (2 Methods)

Photo of author
Written By Larious

Larious is the Executive Editor of LowkeyTech. He is a tech enthusiast and a content writer. 

 

 

 

 

Last Updated on June 9, 2021 by Larious


If you have been using Windows 10 for a while, you might know about the Command Prompt. Command Prompt is one of the best utilities of Windows 10 that allows you to automate and complete a wide range of tasks.

There are plenty of things that you can do with the command prompt. For example, you can utilize the best CMD commands to perform basic stuff. Similarly, there are times when we want to run multiple commands on Command Prompt.

You can execute multiple commands on the Command prompt, but you need to do it manually. What if I tell you that you can run multiple commands at the same time in Command Prompt?

2 Best Methods to run Multiple Commands in CMD

Yes, you can run two commands in one line in Windows Command Prompt. For that, you need to create a batch script file using Notepad. Below, we have shared the two best methods to run multiple commands in CMD on Windows 10 computers. Let’s check out.

1. Using Notepad

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 10 –

  • ipconfig /displaydns
  • ipconfig /flushdns
  • ipconfig /release
  • ipconfig /renew

Step 1. First of all, open the Notepad on your computer.

How to Run Multiple Commands in CMD 2 Methods

Step 2. Now enter the commands that you want to execute in a single click. In this example, we are using the four commands which we have mentioned above.

1623278365 151 How to Run Multiple Commands in CMD 2 Methods1623278365 151 How to Run Multiple Commands in CMD 2 Methods

Step 3. Next, click on the file and select the ‘Save as’ option.

1623278365 118 How to Run Multiple Commands in CMD 2 Methods1623278365 118 How to Run Multiple Commands in CMD 2 Methods

Step 4. Now save this file with the .bat extension. For example, DNSreset.bat

1623278365 91 How to Run Multiple Commands in CMD 2 Methods1623278365 91 How to Run Multiple Commands in CMD 2 Methods

Step 5. If you wish to reset the DNS cache, double click on the batch script file.

1623278365 185 How to Run Multiple Commands in CMD 2 Methods1623278365 185 How to Run Multiple Commands in CMD 2 Methods

That’s it! You are done. This is how you can run multiple commands in Command prompt.

2. Using Special Characters

In this method, we will use some special characters in between the commands to execute them at the same time. Follow the steps given below.

Step 1. If you want to run two or more commands simultaneously, just insert the “&” between the commands. For example – ipconfig /flushdns & ipconfig /renew

1623278365 83 How to Run Multiple Commands in CMD 2 Methods1623278365 83 How to Run Multiple Commands in CMD 2 Methods

Step 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

1623278365 367 How to Run Multiple Commands in CMD 2 Methods1623278365 367 How to Run Multiple Commands in CMD 2 Methods

Step 3. If you want to run the second command only if the first one has failed to execute, then enter “||” between the commands. For example – ipconfig /flushdns || ipconfig /renew

1623278365 784 How to Run Multiple Commands in CMD 2 Methods1623278365 784 How to Run Multiple Commands in CMD 2 Methods

That’s it! You are done. You can use these signs in between commands as per your wish.

So, this article is all about how to run multiple commands in CMD on Windows 10. I hope this article helped you! Please share it with your friends also. If you have any doubts related to this, let us know in the comment box below.

Previous

Download Genymotion for Desktop Latest Version (Offline Installer)

10 Best Writing Apps For Android in 2021

Next

Leave a comment