Computing.Net > Forums > Disk Operating System > Close a batch file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Close a batch file

Reply to Message Icon

Name: Steven
Date: February 11, 2000 at 05:29:48 Pacific
Comment:

I need to write a batch file that will close after it is done. I know you can change the properties to close on exit but that does not help me. I need to close the batch file at the last line of commands. I tried "exit" but that did not work.

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: browser
Date: February 11, 2000 at 07:38:43 Pacific
Reply:

I've never seen a batch file that didn't close when it was finished running, unless you have some type of halt, pause or loop command in it.


0

Response Number 2
Name: geo
Date: February 11, 2000 at 10:47:03 Pacific
Reply:

It has been a while for this so bare with me, but i believe that if you use a batch file to start an exe or another batch file, you have to use the "call" command, so that after the command is ran it will return to the batch file and finish, i cant guarentee this will work but give it a try


0

Response Number 3
Name: browser
Date: February 11, 2000 at 12:13:30 Pacific
Reply:

geo,

You're absolutely correct that this will return you to the batch file, but that isn't what the question seemed to be. A batch file automatically closes when it finishes running.


0

Response Number 4
Name: Laurence
Date: February 12, 2000 at 08:20:46 Pacific
Reply:

Tom Lavedas says:
If it can be assures that the ANSI.SYS driver is not loaded and/or that
the background color of the window is black, then just add these two
commands at the end of the procedure ...

cls
@exit

If the desire is to be iron clad, even when ANSI.SYS is loaded, use ...
(for command all on one line)

for %%v in ("prompt $e[m" "echo on" cls) do %%v
@exit
:::::::::
The above is for Win95-98


0

Response Number 5
Name: theboss
Date: February 15, 2000 at 07:14:29 Pacific
Reply:

what a bloody load of long winded answers just right click 0n batch file, click properties, click the program tab then click "close on exit" then make last line in bat file exit then run bat file from shortcut
simple!


0

Related Posts

See More



Response Number 6
Name: duh
Date: February 18, 2000 at 12:03:57 Pacific
Reply:

Hey bossman, if you had read the problem description, Steven does state that he tried the "close on exit" button and it didnt work for him, so lets just stick with bloody solutions instead of idiotic comments about what other people suggest trying.


0

Response Number 7
Name: Daniel
Date: February 19, 2000 at 18:00:14 Pacific
Reply:

To close a batch file press Alt Tab
or Clt c
and it will close


0

Response Number 8
Name: Jeff
Date: July 20, 2000 at 11:33:25 Pacific
Reply:

Steven I don't know it you found a solution yet, but I has a simular situation. I've come up with two solutions. Put "C:\command.com /c" on the first line before the rest of your command. If that doesn't work, I had to go to the properties of the batch file, and I pointed to the new ".pif" created by the batch properties when I check close on exit. I know you don't want to use the properties option, but the ".pif" may be another solution. Don't forget to edit the "CMD LINE" on the PROGRAM tab to point to where ever you move the .bat and .pif.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Close a batch file

Close Win Program with a Batch File www.computing.net/answers/dos/close-win-program-with-a-batch-file/13949.html

auto-closing a batch file www.computing.net/answers/dos/autoclosing-a-batch-file/10433.html

closing the batch file www.computing.net/answers/dos/closing-the-batch-file/13210.html