我可以在当前批处理文件windows中运行另一个批处理文件吗?
Can I run another batch file in the current batch file windows?
例如,如果我在同一个文件夹中有两个批处理文件 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
我知道它只会在新的 window 中打开 A2.bat,但是无论如何我可以在 [=19] 的现有 window 中打开 A2.bat =]?谢谢
使用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 <b><i>CALL</i></b> A2.bat
if errorlevel 2 exit
start /b A2.bat
将 运行 A2.bat 而不会创建新的 window
例如,如果我在同一个文件夹中有两个批处理文件 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
我知道它只会在新的 window 中打开 A2.bat,但是无论如何我可以在 [=19] 的现有 window 中打开 A2.bat =]?谢谢
使用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 <b><i>CALL</i></b> A2.bat
if errorlevel 2 exit
start /b A2.bat
将 运行 A2.bat 而不会创建新的 window