批处理(.bat)文件的新窗口问题

时间:2009-05-13 19:21:45

标签: winapi batch-file cmd

我正在使用批处理文件打开一些新窗口。一旦他们完成了他们的流程,我就会退出/ c设置。但是,我希望我的主要批处理过程在继续之前等待一个窗口完成,而不是一次完成所有操作。

例如,如果我的主批文件有:

@ECHO OFF

启动“Win1”cmd.exe / c scomp -out ........ \ tasks \ JARs \ MessageLog.jar MessageLog.xsd -compiler“C:\ Program Files \ Java \ jdk1.5.0_18 \ bin \ javac .EXE“

启动“Win2”cmd.exe / c scomp -out ........ \ tasks \ JARs \ OwnshipData.jar OwnshipData.xsd -compiler“C:\ Program Files \ Java \ jdk1.5.0_18 \ bin \ javac 。可执行程序”

我希望Win1在文件移动到Win2之前完成执行。截至目前,它们同时执行。

2 个答案:

答案 0 :(得分:7)

开始/等待“Win1”等。

答案 1 :(得分:4)

您想使用/ wait,请参阅下面的参考资料。

    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)
相关问题