opening a batch file from another one

Can you open a batch file from another one and continue only if the new file finishes its operation?
axcxAsked:
Who is Participating?
 
oBdACommented:
A simple call "S:\ome\batch.cmd" will do the trick; calling a batch from a batch without "call" will end the calling batch at this point and give control to the called batch.
If the batch files are in the same folder, you can use call "%~dp0batch.cmd"; %~dp0 will expand to the script's path and drive, including a trailing backslash.
0
 
Bill PrewCommented:
Can you describe what you mean by "only if the new file finishes its operation"?  Do you just mean wait until the called script reaches it's end of processing, or might you need an error code or something that can be checked in the calling script to see if the called script processed successfully.  In that case for simple checking you can leverage ERRORLEVEL, and "set" it in the called program with the EXIT command, and then check it when you get back to the calling program with and IF statement.  Let us know if you want more detail on that.

~bp
0
 
axcxAuthor Commented:
Just waiting until the second file reaches its end and then resuming the first one. No possibility of error.
0
 
Bill PrewCommented:
Okay, oBdA solution should do just that.

~bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.