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