Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Automatically closing dos window after batch run  (Read 4718 times)

0 Members and 1 Guest are viewing this topic.

Nathan_

  • Guest
Automatically closing dos window after batch run
« on: September 06, 2004, 11:16:56 AM »
Hey All,
I'm new to batch programming, I managed to write one and it works well, all I need now is a command to close the dos window after the execution of the file.......can any one help please?

I've tied EXIT but the dos screen remains open

Thanks in advance

johnwill

  • Guest
Re: Automatically closing dos window after batch r
« Reply #1 on: September 06, 2004, 04:05:16 PM »
Are you using COMMAND.COM in your DOS shortcut or CMD?  I'm assuming 2K or XP, since you didn't specify an O/S.  I use CMD, and my windows close when I have an EXIT in the batch file.  For W98, I believe there's a box you check in the PIF to close the window upon exit.

Nathan_

  • Guest
Re: Automatically closing dos window after batch r
« Reply #2 on: September 07, 2004, 02:54:28 AM »
Hi John,

Actually I don't know what I'm using (cmd/command.com) I just doulbe click the .bat file (no shortcut). I created it with notepad and changed the file extension to .bat.

I'm using nt4 with SP6, windows95, win98SE and Millenium.

I'm guessing the most basic commands will work on all windows O/S. All I'm doing is looking for a file, IF it does EXIST run an .exe on the file, IF NOT EXIST echo messages to the user on what to check for.

Except for NT4, When I use EXIT, it just says finished on the top left of the window..

I can see NT is using the \windows\system32\cmd.exe.
I had a look at the properties and I can verify that the check box is marked for "close on exit".....

« Last Edit: September 07, 2004, 10:17:43 AM by Nathan_ »

Nathan_

  • Guest
Re: Automatically closing dos window after batch r
« Reply #3 on: September 13, 2004, 07:43:45 AM »
Hi John,

Found a solution to my problem......just use CLS as the last instruction and hey presto the window closes.

The source came from www.ericphelps.com/batch/samples/closewindow.txt, who explains the why's therefore's of using EXIT and CLS to close DOS windows....

Regards
Nathan