Saturday, June 12, 2010

How to exit a Windows MS-DOS window through a batch file.

How to exit a Windows MS-DOS window through a batch file.
Issue:


How to exit a Windows MS-DOS window through a batch file.
Reasoning:
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.
• If you do not want the MS-DOS window to automatically close see document CH000738 for additional information about this issue.
Solution:
Add the "exit" command to the end of your batch file. See our exit command page for additional information about this command.
Alternatively, if you are using Windows 95, 98, ME, or NT you can also exit out of a batch file by creating a shortcut to the batch file and making the shortcut automatically close the program. To do this follow the below steps.
1. Create a shortcut to the MS-DOS program or batch file. Additional information about creating a Windows shortcut can be found ondocument CH000739.
2. Once the shortcut has been created right- click the shortcut and click Properties.
3. Click the Programs tab
4. Check the box to "Close on exit."
5. Click Apply and then Ok.
Note: This is no longer available in new versions of Windows such as Windows 2000 or Windows XP.
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 a MS-DOS window may remain open either because the program stopped responding or because it's still performing tasks.

No comments:

Post a Comment