'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).
Solution 1:[1]
I think, you need something like:
start "MyWindow" cmd /c "ping localhost & ipconfig & pause"
Solution 2:[2]
It helps to escape every & with ^&:
START program_a ^&^& program_b ^&^& program_c
Solution 3:[3]
Trying in a batch file, but the two commands (!vexe! and move) are executed at the same time :
start "" /d "!mpwd!" /low /affinity !hex! /b cmd /v:on /c " 1^>"%lcpu%.!cnxt!" 2^>^&1 !vexe! !vcmd! && move /y "%%a" "!mrel!" "
Tried with escaping the && or not, putting the move into parenthesis as well. No luck there...
Any advice ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Stephan |
| Solution 2 | gotwo |
| Solution 3 | Kochise |
