Close Dos Window

peikfeng used Ask the Experts™
Hi all,
  First of all, my platform is WinME, Win2000 and WinXP.

  I have a Java Swing application that I start it up using a batch file. My batch file looks like:

set CLASSPATH=.....
javaw -classpath %CLASSPATH% MySwing

I would like to close the Dos window after MySwing appear and keep MySwing running.
I have tried to put CLS and exit at the end of the batch file but it seems the command stopped at javaw and it won't execute the command after it and the dos window remain there. Btw, I could manually close the dos window while MySwing still running.

How could I programatically close the Dos Window?

Any help will be appreciated. Thank you.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Try using

Start javaw -classpath %CLASSPATH% MySwing

The batch file will then conlete without waiting for the process to complete

two things to try

When a batch file is run it creates a pif file. this should be able to be right clicked and properties will give you an option of "close windows after application ends" or something to that effect.

Secondly try start /w <command here> this will wait for the app to finish before exitting the window (you may or not want to wait for it)

Hope this helps


CLS  = clear screen
EXIT = exit DOS

"I would like to close the Dos window after MySwing appear and keep MySwing running" means that the batch file that called it currently stays active. I.E. /W. He does not want to wait for it!
The exit command wouldn't ever get executed unless the previous process completes.


Thanks for helping to everybody.
I have tried using XstaticX's suggestion and it works great!
Therefore, I've decided to accept XstaticX's comment as answer.

Thank you.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial