简体   繁体   English

如何通过 START 命令运行多个命令

[英]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 .我有一个案例,我需要生成多个CMD实例(使用START程序),并且每个实例都需要依次运行一些命令。 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 (ie not in the CMD instance spawned by START ).我最终生成了一个运行program_aCMD实例,并且“拥有”批处理脚本继续自行执行program_bprogram_c (即不在START生成的CMD实例中)。

I think, you need something like:我想,你需要这样的东西:

start "MyWindow" cmd /c "ping localhost & ipconfig & pause"

It helps to escape every & with ^& :它有助于用^& &

START program_a ^&^& program_b ^&^& program_c

Trying in a batch file, but the two commands (:vexe! and move) are executed at the same time :在批处理文件中尝试,但同时执行了两个命令(:vexe! 和 move):

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?有什么建议吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM