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
566 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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