How to exit a Windows MS-DOS window through a batch file
When a batch file is complete, Microsoft Windows will leave the window open, requiring the user of the computer to manually close it. For convenience, the individual writing the batch file may want to automatically close that window.
Add the "exit" command to the end of your batch file. See the exit command page for additional information about this command.
Alternatively, if you are using Windows 95, 98, ME, or NT you can exit out of a batch file by creating a shortcut to close the program automatically. To do this, follow the steps below.
- Create a shortcut to the MS-DOS program or batch file.
- Right-click the new shortcut and click Properties.
- Click on the Programs tab.
- Check the box to Close on exit.
- Click Apply and then Ok.
Note: This option is no longer available in versions of Windows after 2000.
Finally, it is important to realize that if a batch file or program is still running a program the MS-DOS windows will not close until it has completed. Therefore an MS-DOS window may remain open either because the program stopped responding or because it's still performing tasks.