Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This question already has an answer here:

Don't really know what more I can say really. That window captured below will simply not get any larger. Are there some settings somewhere that will allow me to resize it?

command prompt

See, this limited window thing has left me in a bit of a pickle. Basically I've created an application with a command line GUI (With Ruby's Curses Library), and while everything works beautifully on OSX and Ubuntu Terminals, with Command Prompt, if the Curses Windows are larger than the Command Prompt window as shown below, the whole application crashes with a 'window already closed' error.

So, is there a setting that allows users to resize their Command Prompt window, something that I'll have to put in the documentation.

Here's what the holy grail answer would, be though:

Is there a way to do this from the command line? Could my application detect if the Command Prompt it's running on is of fixed width, and actually programatically run the command to allow the Command Prompt window to be enlarged? Or at least give the user a helpful error message?

share|improve this question

marked as duplicate by Oliver Salzburg Oct 17 '13 at 16:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
I do not know if you can do this from the prompt, but you can do this using the GUI. –  kobaltz Oct 17 '13 at 15:03
    
Your title does not match your "holy grail" answer. As you ask why in the title, but ask for how and processes in the question/ –  AthomSfere Oct 17 '13 at 15:13
    
Fair point, edited –  Starkers Oct 17 '13 at 15:19
    
You can also check my related question: superuser.com/questions/653390/… –  Oliver Salzburg Oct 17 '13 at 16:06

3 Answers 3

up vote 2 down vote accepted

You can change by the command mode con

For example to change the size to 120x40

mode con:cols=120 lines=40

You can also change only the width or height by specifying cols or lines

mode con: lines=40

The space between con: and cols or lines is optional

I don't know if Ruby can access windows APIs or not, but you can execute the above commands to change the size as you wish. If it doesn't support running command directly then you can run it through cmd

cmd.exe /c mode con:cols=NUMCOLS lines=NUMLINES

For some other languages you can directly change the size of console window through console API

using System;

class Program
  {
     static void Main()
     { 
        Console.SetBufferSize(100, 9999); 
     }
  }

EDIT: A shorter command

mode WIDTH,HEIGHT
mode 120,40
share|improve this answer

You have two options:

  1. You can change the window size via code (I don't know how do it from Ruby)
  2. Have your users click on the icon in the top left corner and go to properties, in layout you can set the size.

enter image description here

share|improve this answer
    
Hi Scott! You say " You can change the window size via code " so it is possible to do this with Ruby? Or at least a programming language? I thought I'd have to figure out how to somehow run Command Prompt 'commands', but it can be done with a language? –  Starkers Oct 17 '13 at 15:07
    
As I said, I don't know the Ruby language to know how to do it or if it is even possible, but here is how you do it in powershell. –  Scott Chamberlain Oct 17 '13 at 15:08
    
Thanks a lot, I'll be looking into this :) –  Starkers Oct 17 '13 at 15:09
    
for changing the size by code you can do like my answer –  Lưu Vĩnh Phúc Oct 17 '13 at 23:57

Right Click on the Title Bar and select Properties or Defaults (if you want this change to persist).

enter image description here

Go under the Layout Tab and select the Width. You can change this value to your likings

enter image description here

Profit. :)

enter image description here

share|improve this answer
1  
select defaults instead of properties will save the options for all future command prompt windows –  Lưu Vĩnh Phúc Oct 17 '13 at 15:08
    
Good point. I'll update the answer. –  kobaltz Oct 17 '13 at 15:10
    
May also help you to drop the font size, while you're at it. –  Debra Oct 17 '13 at 23:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.