views:

48

answers:

1

I have a script that is supposed to sit there, happily running in a command window, spewing out data... but I want the window to close automatically when the script finishes or crashes. The script is auto-restarted by other processes and I don't want my processing machines to become polluted with unused terminals.

In a pinch, I have considered setting up the scripts as windows services that dump their output to a file and just having the command windows "tail -f" the output files, but I"d prefer not to make major changes to a system that already works well.

A: 

When you start a command line program that's the usual behavior. The console will stay there as long as the process is running and once it dies (naturally or by accident) the console window closes.

This also holds true for scripts, batch files and the like.

If you explicitly run cmd with a batch file or program, then you should provide the /c argument instead of /k.

Joey