Windows Batch calling program does not wait for the child process parent process to continue executing the command

Source: Internet
Author: User

The veteran who comes from DOS should know the batch, which is still in Windows. Batch processing the white is to write a series of DOS commands in a text file, and then name the file as Xxx.bat (WinXP later the system can also be named *.cmd), and then run it can execute a series of commands and programs, of course, including programs under Windows. when dealing with a problem yesterday, I needed to write a batch that ran several DOS commands before the batch, and finally called a Windows program. The problem is that when the calling Windows program opens, the CMD Command Prompt window does not close, but waits until the Windows program shuts down before it shuts down. Recall that the previous DOS batch processing, is to execute a program, and then wait for the program to complete before executing the next program, because DOS is a single-tasking operating system. But is there any way in Windows for the batch handler to continue executing the next command without waiting for the program to end? Search the Internet, also did not find a result. I studied for a half day and finally solved it. The key to the solution is to use a less common command: StartAt first my batch was written like this ("/" and the following is a comment):
@echo off   / This is what command dos   command is not allowed to run in the cmd window         / This is a series of DOS commands instead of ABC          /   echo"OK"       /ping5127.1 >nul           /        

that's the problem. You cannot automatically close the cmd window after running Abc.exe. And then I finally thought of it. There is a start command in the command specifier of windows, thinking that using it might not wait for the Abc.exe to execute. The batch was then replaced with:
@echo Off/ This is a command that does not let the cmd window show what commands to run DOS command / This is a series of DOS commands that replace the start ABC/
    
      >
     echo
     "
     OK
     " /
     
     ping
     5
     127.1 >nul
     /
     
    

sure enough, after the Abc.exe runs, the batch continues to execute the exit command behind it and exits. Originally, the program that was called with start will not wait for the program to finish running. If you meet a friend who has the same problem as me, try it.

Reference: Http://www.cnblogs.com/yukaizhao/archive/2010/07/03/1770659.html

Windows Batch Invoker does not wait for the child process parent process to continue executing the command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.