Monster
Monster

Reputation:

New window question for batch (.bat) files

I'm using a batch file to open a few new windows. Once they complete their processes, I have the /c set they quit. However, I'd like for my main batch process to wait for one window to finish before moving on, instead of doing everything 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 scomp -out ........\tasks\JARs\OwnshipData.jar OwnshipData.xsd -compiler "C:\Program Files\Java\jdk1.5.0_18\bin\javac.exe"

I'd like Win1 to complete its execution before the file moves to Win2. As of now though, they execute concurrently.

Upvotes: 3

Views: 1690

Answers (2)

Kladskull
Kladskull

Reputation: 10732

You want to use /wait, see the reference 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)

Upvotes: 4

Dave Costa
Dave Costa

Reputation: 48111

start /wait "Win1" etc.

Upvotes: 7

Related Questions