Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run multiple commands via START command

I have a case where I need to spawn multiple CMD instances (using the START program), and each instance needs to run some commands in sequence. These commands are generated by a batch script, so they are not known ahead of time.

Basically, what I'm looking to do is something like the following, but I don't know the proper syntax (or if it's even possible):

START (program_a && program_b && program_c)

Obviously, those parentheses are incorrect syntax. So when I try to run some syntactically correct variant(s):

START program_a && program_b && program_c

I just end up with one CMD instance being spawned, running program_a, and the "owning" batch script continues to execute program_b and program_c on its own (i.e. not in the CMD instance spawned by START).

like image 406
inspector-g Avatar asked Jan 09 '16 19:01

inspector-g


People also ask

Can you run 2 command prompts at once?

Click Start, type cmd, and press Enter to open a command prompt window. In the Windows taskbar, right-click the command prompt window icon and select Command Prompt. A second command prompt window is opened.

How do I run multiple commands in one batch file?

Instead of scheduling multiple Windows Tasks that may overlap, use the "start /wait" command a batch file (. bat) to automatically run multiple commands in sequential order.

Can you do multiple commands in one command block?

To make your command block run multiple commands, you will need to summon FallingSand or falling_block (depending on your version of Minecraft) with command blocks and redstone blocks for each command. The command blocks will be stacked one on top of the other and contain the individual command.


1 Answers

I think, you need something like:

start "MyWindow" cmd /c "ping localhost & ipconfig & pause"
like image 80
Stephan Avatar answered Sep 22 '22 16:09

Stephan