WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DOS

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Exiting A DOS Window

Keywords: exit dos window


Question:

How do I exit a DOS window?

Answer:

You could either set up a DOS Pif file to automatically exit and close the DOS window when your program finishes executing (see How to Create and Modify a DOS PIF file elsewhere on this website), or you could send keystrokes to the DOS window to close it, as follows:
        WinActivate("Command")  ;the DOS windowname
        cr=Num2Char(13) ; sets the CR
        ClipPut("exit%cr%")  ;puts exit in the clipboard
        SendKey("+{insert}") ; DOS Paste
        Delay(2)
        WinActivate("Program Man")
        SendKey("!FR") :key sequence for FIle/Run

That should take care of it. When using WinActivate, case matters in the windowname.

Alternatively, you could close the DOS window with the following script, substituting your specific DOS Window title name for "MS-DOS Prompt":

        if WinExist("MS-DOS Prompt") ==@true then winclose("MS-DOS Prompt")

Article ID:   W12886
Filename:   Exiting A DOS Window.txt
File Created: 1999:04:15:16:50:18
Last Updated: 1999:04:15:16:50:18