Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 212
  • Last Modified:

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?
0
axcx
Asked:
axcx
  • 2
1 Solution
 
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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now