Solved

How do I close the cmd window automatically after running a batch file from another batch file, exit doesnt work?

Posted on 2009-04-15
2
568 Views
Last Modified: 2012-08-14
Im using a batch file to run some commands stored in another batch file, by using the start command. However after the second batch file has been run the window of the first one remains open. I have tried to add an exit command at the end of the first batch, but it changes nothing. How do I close all the command windows after processing?
0
Comment
Question by:Suppai
2 Comments
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 24145956
What *exactly* are you trying to do?
To call another batch script from your current one, you can simply use
call TheBatch.cmd
The scripts will then all run in the same window; what happens with the window after the script is finished depends on how the script was started:
* if it was started from an open command prompt, this command prompt will by default stay open (which is useful, especially when testing the script; plus a script/program actually has no business closing a command prompt it didn't open itself).
* if it was started through a doubleclick in Explorer or from the Run menu, the window will close automatically after it's finished.
0
 

Author Closing Comment

by:Suppai
ID: 31570328
The call command did the trick. Apparently the start command isnt appropriate for running other batch scripts sequentially.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

773 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