Computing.Net > Forums > Windows 95/98 > DOS Batch Not Working

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.

DOS Batch Not Working

Reply to Message Icon

Name: Stumped Guy
Date: March 27, 2003 at 02:09:47 Pacific
OS: Windows 98SE
CPU/Ram: 450Mz Intel Chip with 256
Comment:

I have encountered a bizarre problem which I've been completely unable to fathom:

I have a small batch file which I've written to perform a certain job on the hard drive. Now it is my desire to have this batch file terminate itself when the job is finished, so, naturally, I conlcuded my text with the command 'exit'.

When the file is run, however, the task is successfully completed, but the DOS window just hangs around on the screen, waiting for me to click the X box in the upper right to close it.

I wrote the following batch this morning:

echo off
cls
echo.
echo Test File
echo.
exit

The same result. The task (in this case displaying text) ran fine, but the program just stopped when it had finished instead of automatically exiting.

Anyone have any ideas???

PS: Please answer by email only (smokingmirror@hotmail.com), as it's not always possible for me to get on these forums very much. Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: jboy
Date: March 27, 2003 at 02:33:21 Pacific
Reply:

Right click the batch file and under properties, program, choose 'close on exit'

Sorry, if you can manage to check your email, you can find time to check your post - this is an open forum.


0

Response Number 2
Name: TheGorx
Date: March 27, 2003 at 04:32:41 Pacific
Reply:

I always use
cls
to exit dos in windows
but a shortcut works too
with close on exit.

TheGorx - Windows Help


0

Response Number 3
Name: Dan Penny
Date: March 27, 2003 at 10:53:50 Pacific
Reply:

Maybe I'm missing something here, but Gorx, how does the clear screen command exit a dos window? (Hey jboy!)


0

Response Number 4
Name: FishMonger
Date: March 27, 2003 at 13:03:35 Pacific
Reply:

In this case the exit is not needed. Once the batch file completes its final command, then the program is finished and it will automatically exit. The exit command would be used if you need to quit the program prior to the final command. The real problem here is to close the DOS window which is done by the method that jboy described.


0

Response Number 5
Name: TheGorx
Date: March 27, 2003 at 13:57:00 Pacific
Reply:

well there is exit and then there's close the window.

my guess would be because it's still has text in the window the exit command isn't closing it just not making it active anymore.

when you use the close on exit setting it will create a PIF file


0

Related Posts

See More



Response Number 6
Name: Derek
Date: March 27, 2003 at 17:11:00 Pacific
Reply:

I have several batch files all of which have cls as the last line. The "close window on exit" is not ticked. They all close fine.

Derek


0

Response Number 7
Name: daniel
Date: March 27, 2003 at 21:31:11 Pacific
Reply:

I just did a test. Created a bat file with CLS as the last command. The window did not close.
Win98SE system.
AMD CPU


0

Response Number 8
Name: TheGorx
Date: March 27, 2003 at 22:46:09 Pacific
Reply:

I just did a test and it works fine
windows 98se

-----------------

echo off
cls
echo.
echo testing 1..2..3
echo.
echo.
pause

cls
-----------------

the only thing I can think of is if you running something else thru the bat file.

such as using the Call or the Start commands or just running a path to another batch file or app.
each one while similar have slite differences.

I can't tell you why it's not working on your system but I can tell you it does work.


0

Response Number 9
Name: Dan Penny
Date: March 28, 2003 at 00:21:18 Pacific
Reply:

Ran your file Gorx, and got;


testing 1..2..3


Press any key to continue . . .

Didn't close the dos window.

???????


0

Response Number 10
Name: Derek
Date: March 28, 2003 at 12:51:49 Pacific
Reply:

One possible reason why cls doesn't clear a batch file (not checked) is if there is a Return after it. There should always be a Return at the end of a .reg file but never after a .bat file.


0

Response Number 11
Name: The Count
Date: March 28, 2003 at 16:15:28 Pacific
Reply:

With or without a Return at the end it worked on my pc :~/
Windows 98 [Version 4.10.2222]

Greetz,
The Count


0

Response Number 12
Name: Derek
Date: March 28, 2003 at 19:17:43 Pacific
Reply:

The Count

Thanks for follow-up & info.

I recall there was some problem or other that a Return at the end of a batch file once caused me, so I never use it.

Sorry, I've forgotten the exact circumstances but you've obviously proved that it's not this particular situation.

Derek


0

Sponsored Link
Ads by Google
Reply to Message Icon

Opening Task Manager? NVidia GForce 2 Probs



Post Locked

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


Go to Windows 95/98 Forum Home


Sponsored links

Ads by Google


Results for: DOS Batch Not Working

ms dos prompt not working www.computing.net/answers/windows-95/ms-dos-prompt-not-working/136919.html

Keyboard Command key shortcuts do not work. www.computing.net/answers/windows-95/keyboard-command-key-shortcuts-do-not-work/33793.html

canon LBP 660printer/scanner do not work together www.computing.net/answers/windows-95/canon-lbp-660printerscanner-do-not-work-together/32203.html