我正在使用TeamCity 9.我想在一个构建步骤中一个接一个地运行两个批处理文件。
如果我在构建步骤中写这个:
BATCH_1.bat <arg1> <arg2> BATCH_2.bat <arg1> <arg2>只有BATCH_1.bat被执行...我改变了序列,然后只执行了BATCH_2.bat 。 这意味着,只有构建步骤中的第一个批处理文件才会执行,控制权将转移到下一个构建步骤。
当我分离构建步骤时,两个批处理文件都已执行。 但是当我一步到位时,只有一个执行。
有趣的是ECHO语句在BATCH_1之前执行但在之后没有执行。
是否有限制只能在构建步骤中执行一个批处理文件?
I am using TeamCity 9. I want to run two batch files one after another in one build step.
If I write this in a build step:
BATCH_1.bat <arg1> <arg2> BATCH_2.bat <arg1> <arg2>Only BATCH_1.bat gets executed... I changed sequence, then only BATCH_2.bat got executed. That means, only first batch file in build step is getting executed and control moves to next build step.
When I separated build steps, both batch files got executed. But when I bring them in one step, Only one executes.
Interesting thing is ECHO statements get executed before BATCH_1 but not after it.
Is there any restriction that only one batch file can be executed in a build step?
最满意答案
TeamCity在使用命令步骤时的工作方式是将步骤中的所有命令放入单个.cmd文件中,并要求命令行解释程序执行它。
所以这不是TeamCity的限制,它是命令行解释器的限制。
要让解释器返回到您的第一个批处理文件(生成的TeamCity),您必须调用其他批处理文件。
试试这个:
CALL BATCH_1.bat <arg1> <arg2> CALL BATCH_2.bat <arg1> <arg2>The way TeamCity works when using the command step is that it puts all the commands in your step into a single .cmd file and asks the command line interpreter to execute it.
So this is not a limit of TeamCity, it is a limit of the command line interpreter.
To have the interpreter return back to your first batch file (the one TeamCity generated) you will have to call the other batch files.
Try this:
CALL BATCH_1.bat <arg1> <arg2> CALL BATCH_2.bat <arg1> <arg2>更多推荐
发布评论