如何在 .BAT 文件中运行多个 .BAT 文件 [英] How to run multiple .BAT files within a .BAT file

查看:152
本文介绍了如何在 .BAT 文件中运行多个 .BAT 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让我的 commit-build.bat 执行其他 .BAT 文件作为我们构建过程的一部分.

I'm trying to get my commit-build.bat to execute other .BAT files as part of our build process.

commit-build.bat 的内容:

"msbuild.bat"
"unit-tests.bat"
"deploy.bat"

这看起来很简单,但 commit-build.bat 只执行列表中的第一项(msbuild.bat).

This seems simple enough, but commit-build.bat only executes the first item in the list (msbuild.bat).

我已经分别运行了每个文件,没有任何问题.

I have run each of the files separately with no problems.

推荐答案

使用:

call msbuild.bat
call unit-tests.bat
call deploy.bat

不使用CALL时,当前批处理文件停止,被调用的批处理文件开始执行.这是一种可以追溯到早期 MS-DOS 时代的特殊行为.

When not using CALL, the current batch file stops and the called batch file starts executing. It's a peculiar behavior dating back to the early MS-DOS days.

这篇关于如何在 .BAT 文件中运行多个 .BAT 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆