案例一

  • hello.bat

    1. CALL hello1.bat
    2. CALL hello2.bat
    3. @echo.&pause

    @echo.&pause 当前窗口换行且不退出。
    运行时,会先等hello1.bat执行完毕,在执行hello2.bat

  • hello1.bat

    1. java -jar hello1.jar
  • hello2.bat

    1. java -jar hello2.jar

案例二

  • hello.bat
    1. java -jar hello1.jar
    2. java -jar hello2.jar
    3. @echo.&pause
    @echo.&pause 当前窗口换行且不退出。
    运行时,会先等第一行的java命令执行完毕,在执行第二行的java命令

附java测试代码:

  1. public class Main {
  2. public static void main(String[] args) throws InterruptedException {
  3. System.out.println("1");
  4. Thread.sleep(10000);
  5. System.out.println("2");
  6. }
  7. }
  1. public class Main {
  2. public static void main(String[] args) throws InterruptedException {
  3. System.out.println("3");
  4. }
  5. }

执行时总是先输出 1、2,最后在输出3