New question for batch (.bat) files

I am using a batch file to open several new windows. When they complete their processes, I have the / c set that they complete. However, I would like my main batch process to wait for one window to complete before moving on, instead of doing it all at once.

For example, if my main batch file has:

@ECHO OFF

start "Win1" cmd.exe / c scomp -out ........ \ tasks \ JARs \ MessageLog.jar MessageLog.xsd -compiler "C: \ Program Files \ Java \ jdk1.5.0_18 \ bin \ javac .exe "

start "Win2" cmd.exe / c scompoutout ........ \ tasks \ JARs \ OwnshipData.jar OwnshipData.xsd -compiler "C: \ Program Files \ Java \ jdk1.5.0_18 \ bin \ javac.Exe "

I would like Win1 to complete execution before the file moves to Win2. They are currently running at the same time.

+3
source share
2 answers

start / wait for "win1" etc.

+7
source

You want to use / wait, see the link below.

    START

    Start a specified program or command in a separate window.

    Syntax
          START "title" [/ Dpath] [options] "command" [parameters]

    Key:
       title: Text for the CMD window title bar (required)
       path: Starting directory
       command: The command, batch file or executable program to run
       parameters: The parameters passed to the command

    Options:
       /MIN       : Minimized
       /MAX       : Maximized
       /WAIT      : Start application and wait for it to terminate
       /LOW       : Use IDLE priority class
       /NORMAL    : Use NORMAL priority class
       /HIGH      : Use HIGH priority class
       /REALTIME  : Use REALTIME priority class

       /B         : Start application without creating a new window. In this case
                    ^C will be ignored - leaving ^Break as the only way to 
                    interrupt the application
       /I         : Ignore any changes to the current environment.

       Options for 16-bit WINDOWS programs only

       /SEPARATE   Start in separate memory space (more robust)
       /SHARED     Start in shared memory space (default)
+4

Source: https://habr.com/ru/post/1708283/


All Articles