Answer the question
In order to leave comments, you need to log in
How to wait for the execution of the previous command?
Such is the problem
. I have 3 nodejs files, let's say file1.js file2.js file3.js
We need to simultaneously start the execution of files file1.js and file2.js
And after that both scripts finish their work, exit the current folder cd .. and run filte3. js
Answer the question
In order to leave comments, you need to log in
Do you need a batch file that does this?
file1.js start with the command start
file2.js - start in the usual way (without start).
They don't start at the same time, of course, but at least file2.js will start right after file1.js starts. In this case, the batch file will wait until file2.js finishes executing and only after that it will continue to run further.
At the end start file3.js.
If, before starting file3.js, you need to make sure that exactly file1.js and file2.js have completed work (file2.js has definitely already completed work, but file1.js can still work, because it was launched through start and there is no batch file with it not synchronized), then before starting it, you need to check whether file1.js is still working using the tasklist in a cycle with a pause.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question