我可以在当前批处理文件窗口中运行另一个批处理文件吗?

时间:2015-01-11 09:32:11

标签: batch-file cmd

例如,如果我有两个批处理文件,A1和A2,在同一个文件夹中,我想从A1加载A2,如下面的代码:

::This is a program loader
::A2.bat is another batch file within the same folder
title A1
@echo off
choice /m "Do you wish to proceed?"
if errorlevel 1 start A2.bat
if errorlevel 2 exit

我知道它会在新窗口中打开A2.bat,但无论如何我可以在A1.bat的现有窗口中打开A2.bat吗?感谢

2 个答案:

答案 0 :(得分:4)

使用call代替start

::This is a program loader
::A2.bat is another batch file within the same folder
title A1
@echo off
choice /m "Do you wish to proceed?"
if errorlevel 1 CALL A2.bat
if errorlevel 2 exit

答案 1 :(得分:-2)

start /b A2.bat将运行A2.bat而不创建新窗口

相关问题