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
573 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 84

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Suggested Solutions

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…
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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

726 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