Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9252653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:00:03+00:00 2026-06-18T11:00:03+00:00

If from inside a bat file you called another batch file but still had

  • 0

If from inside a bat file you called another batch file but still had a few remaining operations to complete, how can you make sure that the call to first bat file will after completion or error, will return to the file that called it in the first instance?

Example:

CD:\MyFolder\MyFiles
Mybatfile.bat

Copy afile toHere

or

CD:\MyFolder\MyFiles
CALL Mybatfile.bat

COPY afile toHere

What is the difference between using CALL or START or none of them at all? Would this have any impact on whether it would return for the results of the copy command or not?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:00:06+00:00Added an answer on June 18, 2026 at 11:00 am

    As others have said, CALL is the normal way to call another bat file within a .bat and return to the caller.

    However, all batch file processing will cease (control will not return to the caller) if the CALLed batch file has a fatal syntax error, or if the CALLed script terminates with EXIT without the /B option.

    You can guarantee control will return to the caller (as long as the console window remains open of course) if you execute the 2nd script via the CMD command.

    cmd /c "calledFile.bat"
    

    But this has a limitation that the environment variables set by the called batch will not be preserved upon return.

    I’m not aware of a good solution to guarantee return in all cases and preserve environment changes.

    If you really need to preserve variables while using CMD, then you can have the “called” script write the variable changes to a temp file, and then have the caller read the temp file and re-establish the variables.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I set a class variable from inside a function inside another function?
From inside my index.php file, say, I'd like to check if another PHP file
From inside of the fireAlert() function, how can I reference the element that called
I have a Toast that is called from inside a Service . It always
How can I call a function from inside the function, so it becomes recursive?
How can I get Google search results from inside a program? I need to
I want to create one bat file that will move files from one location
I need to execute a Lua script from inside another Lua script. How many
How can I check from inside a java program if python is installed in
Need to write batch script which copies file from FTP to local drive I'm

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.