Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
588 views
in Technique[技术] by (71.8m points)

batch-file - 如何在一个.BAT文件中运行多个.BAT文件(How to run multiple .BAT files within a .BAT file)

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

(我正在尝试使我的commit-build.bat执行其他.BAT文件,这是我们构建过程的一部分。)

Content of commit-build.bat :

(commit-build.bat内容:)

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

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

(这似乎很简单,但是commit-build.bat只执行列表中的第一项( msbuild.bat )。)

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

(我已经分别运行每个文件,没有问题。)

  ask by translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Use:

(采用:)

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

When not using CALL, the current batch file stops and the called batch file starts executing.

(不使用CALL时,当前的批处理文件将停止并且被调用的批处理文件开始执行。)

It's a peculiar behavior dating back to the early MS-DOS days.

(这是可以追溯到早期MS-DOS时代的一种特殊行为。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...