在TeamCity 9的一个构建步骤中运行两个批处理文件(Running two batch files in one build step of TeamCity 9)

编程入门 行业动态 更新时间:2024-10-08 22:47:54
在TeamCity 9的一个构建步骤中运行两个批处理文件(Running two batch files in one build step of TeamCity 9)

我正在使用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>

更多推荐

本文发布于:2023-07-09 10:03:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1085518.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:步骤   批处理文件   两个   TeamCity   Running

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!