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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Exe program is not a valid Win 32 application 15 107
active directory 5 55
Event ID: 7016 / Source: Microsoft-Windows-GroupPolicy 7 102
Combine DSQuery result into loop script 6 52
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

867 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

18 Experts available now in Live!

Get 1:1 Help Now