For Sites: All Sites  * Wordpress   For Browsers: All Browsers  * Firefox  * IE  * Chrome

» Home » Troubleshooter » How to close a batch (dos) window automatically after execution

How to close a batch (dos) window automatically after execution


Do you wish a batch window would close immediately after execution? In XP and later Windows versions the window that the batch file opens, remains open for as long as all applications and documents opened by that batch file remain open.

To solve this problem and have the window of the batch file close immediately, use the start command in front of the file names. E.g., If we write a batch file to open the tlg application and a Word document

"C:\Program Files\TLGWork\tlg32.exe"
"C:\My Documents\practice.doc"

This batch file will wait for tlg.exe and practice.doc to close before it closes its window. In Windows XP or later we should write:

start "" "C:\Program Files\TLGWork\tlg32.exe"
start "" "C:\My Documents\practice.doc"

and the batch file will close right after the TLG application opens and practice.doc is loaded in MS Word.

Related (automatically selected)



4 Responses to “How to close a batch (dos) window automatically after execution”

  • Daniel - November 18th, 2008 00:16

    Thanks for the good information. I was waiting for some time for this.

  • tutumannyaque - February 7th, 2011 23:59

    Thanks ! Worked perfectly ! Useful tips like this are pretty damn rare.

  • Reidy105 - March 31st, 2011 00:19

    Thank you just what I’ve been looking for

  • verkkopeli - May 26th, 2011 13:40

    Excellent piece of advice, thank you very much!

    After a bit of fiddling I discovered that the ‘start’ command enables executing a program and then opening a file within that program, after which the DOS prompt will still disappear. Here’s an example that opens “notes.txt” within notepad and exits:

    @echo off
    start notepad "notes.txt"


don't miss »     Sleeper   Power Copy   Savy   Windows 8 Gadgetarian
Favorite Launcher   Windows Rule   SearchALL Gadget   Amazon Gadget