Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

batch file to open multiple command prompts and execute the same task

Tags:

batch-file

cmd

I want a batch script which opens up multiple command prompt on a single click and runs the same command over and over again . i have written a below code which only opens an single command prompt and stops there .is there a way to do the same.

   for /l %%x in (1, 1, 5) do (
    start cmd /c 
    cd / && dir /s
   )
like image 679
Santhosh Pai Avatar asked Jul 18 '13 04:07

Santhosh Pai


People also ask

How do I run multiple commands in one batch file?

Try using the conditional execution & or the && between each command either with a copy and paste into the cmd.exe window or in a batch file. Additionally, you can use the double pipe || symbols instead to only run the next command if the previous command failed.

Can a batch script file run multiple commands at the same time?

You can use batch scripts to run multiple commands and instructions on your machine simultaneously. Using a batch script, you will be able to execute all your commands one by one automatically.

How do I open multiple command prompts?

Open multiple command prompts in Windows 10In the Windows taskbar, right-click the command prompt window icon and select Command Prompt. A second command prompt window is opened.


1 Answers

   for /l %%x in (1, 1, 5) do (
    start cmd /c "cd / && dir /s && pause"
   )

It opens different command prompts ...

like image 188
npocmaka Avatar answered Oct 12 '22 14:10

npocmaka