How can I open a console application with a given window size?

Posted by Oliver Salzburg on Super User See other posts from Super User or by Oliver Salzburg
Published on 2013-10-02T16:00:15Z Indexed on 2014/08/25 16:23 UTC
Read the original article Hit count: 245

Filed under:
|
|

The application I want to start is MongoDB. If I would start it normally, it looks like this:

enter image description here

I don't like the amount of line breaks and I have a lot of screen space, so I would like to utilize said space to get rid of the line breaks.

I can change the size of the console window with MODE, so I wrote a batch file like this:

@ECHO OFF
MODE con:cols=140 lines=70
%~dp0mongodb\bin\mongod --dbpath %~dp0data --rest

So far, so good. When I start this batch file, I get a larger window, as desired.

But when I now press Ctrl+C to exit MongoDB, I get the annoying prompt:

Terminate batch job (Y/N)?

Which is useless, because the command I just exited out of was the last command in the batch job anyway and no matter what I answer, the result is the same.

So, how can I get a larger console window for the application without having that prompt when I hit Ctrl+C?

© Super User or respective owner

Related posts about Windows

Related posts about command-line