opening a batch file from another one

Posted on 2014-08-27
Last Modified: 2014-08-28
Can you open a batch file from another one and continue only if the new file finishes its operation?
Question by:axcx
    LVL 82

    Accepted Solution

    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.
    LVL 51

    Expert Comment

    by:Bill Prew
    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.


    Author Comment

    Just waiting until the second file reaches its end and then resuming the first one. No possibility of error.
    LVL 51

    Expert Comment

    by:Bill Prew
    Okay, oBdA solution should do just that.


    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Suggested Solutions

    Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now