Resolve a problem where the cmd command cannot be executed continuously

Source: Internet
Author: User

Write the project build script with a batch file (. bat or . cmd) Some time ago and find a strange problem.

is a few different build commands, such as the following two articles:

Coffee-c src/jade-p Demo/

Each of these two commands can be executed normally. However, when I put these commands into a batch script file execution is not completed smoothly, the script is executed when the first command is finished automatically terminated.

I am very puzzled about this question, I do not know where the problem is. I think this might be my own example, so I can only set up a script file for each instruction, and then run it manually in order each time.

Later, I feel more and more trouble, there should always be a solution. Then on the Internet to search for some, and finally found a solution (Reference page).

The solution is to add a call command before each command , such as the above two commands:

 call coffee-c src/ call Jade-p demo/

This will smooth out all the commands.

As for the reason, the predecessor who encountered the same problem explained that it was possible that the program that executed the command terminated the currently running batch at the time of exiting. Adding the call command allows subsequent commands to be executed in the newly opened execution environment (possibly a process), preventing the subroutine from terminating the main script prematurely.

Hopefully this will help people with the same problems.

Resolve a problem where the cmd command cannot be executed continuously

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.