Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


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