Why is the Windows cmd.exe limited to 80 characters wide?

Cmd

Cmd Problem Overview


I love stretching my terminal on unix. What is the history or reason behind windows lame command line?

Cmd Solutions


Solution 1 - Cmd

It isn't. You can right click the title bar, select properties, and in the "Layout" tab alter the screen buffer size (line width and scrollback) and the window size (viewport size). If you started cmd from a shortcut, you can save these settings for future sessions.

Solution 2 - Cmd

If you are mouse-phobic you can also just type this inside the cmd window:

mode <cols>,<lines>
mode 80,25
mode 120,50
etc.

Solution 3 - Cmd

It's not limited.

  1. Run cmd.exe
  2. Click on the icon in the upper left hand of the screen.
  3. Select Properties
  4. Select the Layout tab.
  5. Set the buffer and window widths to whatever you like.
  6. Click OK
  7. Select Save Properties for future...
  8. Click OK.

You might want to check out Console. It's an open source app that lets you run multiple shells in a tabbed environment. You can also set the alpha-transparency of the shells.

Solution 4 - Cmd

RE: Because MS value "backwards compatibility" over a lot of things and in this case I suspect it's a misplaced belief that it will somehow unnerve people if they don't have their standard 80 wide window.

The backwards compatibility works pretty terribly, though. I don't imagine Microsoft was pretty thorough about their implementation of it, and I do believe Microsoft is the poster boy for making sure newer versions won't work on older versions. A lot doesn't work properly under COMMAND.COM, which considerably sabotages the usefulness it possesses, not to mention that you have to enter DOSONLY to make some programs run properly, plus Microsoft has been removing useful commands. Honestly, I can't imagine Microsoft holds "backwards compatibility" in much of a high regard.

Furthermore, I think the real reason why the line length is at a standard of 80 columns is because most command-line programs, etc. operate under the assumption that the user is capped at an 80 column prompt, meaning that increasing the width can cause formatting errors or worse possibly break programs altogether.

As jmucchiello mentioned, MODE will work fine for resizing the window if you feel like it.

Configures system devices.

Serial port: MODE COMm[:] [BAUD=b] [PARITY=p] [DATA=d] [STOP=s] [to=on|off] [xon=on|off] [odsr=on|off] [octs=on|off] [dtr=on|off|hs] [rts=on|off|hs|tg] [idsr=on|off]

Device Status: MODE [device] [/STATUS]

Redirect printing: MODE LPTn[:]=COMm[:]

Select code page: MODE CON[:] CP SELECT=yyy

Code page status: MODE CON[:] CP [/STATUS]

Display mode: MODE CON[:] [COLS=c] [LINES=n]

Typematic rate: MODE CON[:] [RATE=r DELAY=d]

If you have DOSONLY enabled on your CONFIG.NT, however, when you open COMMAND.COM, it will inherit a proper DOS-style line resolution from cmd.exe, but you cannot invoke MODE from inside COMMAND.COM. If you wish to resize inside COMMAND.COM, you will have to use 16-bit assembly instructions, like so:

80x50 Line Resolution (No framebuffer, no SVGA, virtually universally supported.)

DEBUG
A100
MOV AX,1112
INT 10
INT 20

G Q

132x60 Line Resolution (No framebuffer, requires SVGA. Won't work on ATI gfx cards, usually works on nVidia gfx cards, afaict always works on Intel integrated gfx cards.)
DEBUG
A100
MOV AX,4F02
MOV BX,010C
INT 10
INT 20

G Q

If you enter this on your COMMAND.COM, it will give you the specified resolution. (Warning: If your monitor is ancient enough not to support the mode, you might wind up destroying it. Side-note: If you can run Windows, your monitor should be fine. Disclaimer: Emphasis on should, and you've been warned, so it's not my problem if your monitor fries. ;-) However, if you use this without DOSONLY enabled, COMMAND.COM will resize back to its previous size as soon as the application (in this case, unless you wrote it to a file and executed that, DEBUG) exits.

Alternatively, you could use FreeDOS's MODE.COM, which will run properly under COMMAND.COM set to DOSONLY. You can either pull it from the disk image at the official website (freedos.org) or get it at http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/dos/mode/2005/.

New FreeDOS MODE by Eric Auer 2003-2005. License: GPL.   (version 12may2005)
MODE [device] [/STA[TUS]]                (show status of one or all devices)
MODE LPTn[:] cols[,[lines][,retry]]     (cols or cpi, 6/8 lpi, retry p or n)
MODE LPTn[:] [COLS=...] [LINES=...] [RETRY=...] (retry: p infinite / n none)
MODE LPTn[:]=[COMn[:]|NUL]     (redirect printer data to serial port or NUL)
MODE COMn[:] baud,parity,data,stop,retry              (empty values allowed)
MODE COMn[:] [BAUD[HARD]=...] [PARITY=...] [DATA=...] [STOP=...] [RETRY=...]
Baud can be abbreviated to unique prefix,  parity can be o/e/n/s/m,  the
latter 2 mean space/mark, data can be 5..8, stop 1..2. Retry is IGNORED!
PLANNED: Retry b/e/r -> busy/error/ready if busy, p/n infinite/no retry.
MODE CON[:] [CP|CODEPAGE] [/STA[TUS]]       (FreeDOS DISPLAY must be loaded)
MODE CON[:] [CP|CODEPAGE] REF[RESH]                          (needs DISPLAY)
MODE CON[:] [CP|CODEPAGE] SEL[ECT]=number                    (needs DISPLAY)
MODE CON[:] [CP|CODEPAGE] PREP[ARE]=((codepage) filename)    (needs DISPLAY)
Use PREP=((,cp2,cp3,,cp5) ...) to prep codepages in other buffers.
MODE [40|80|BW40|BW80|CO40|CO80|MONO][,rows]  (rows can be 25, 28, 43 or 50)
Use 8, 14 or 16 as 'rows' value if you only want to change the font.
MODE [CO40|CO80|...],[R|L][,T] (shift CGA left/right, T is interactive mode)
MODE CON[:] [NUMLOCK|CAPSLOCK|SCROLLLOCK|SWITCHAR]=value
Value can be: + or - for the locks or a character for switchar.
MODE CON[:] [COLS=...] [LINES=...] (possible values depend on your hardware)
MODE CON[:] [RATE=...] [DELAY=...]        (default rate 20, default delay 1)
Rate can be 1..32 for 2..30 char/sec,  delay can be 1..4 for 1/4..4/4 sec.

For the same reasons as with the ASM code I provided, unless you execute it in COMMAND.COM with DOSONLY added to your CONFIG.NT file, the window will immediately rebound to its previous size once MODE.COM exits.

Lastly, as others have stated, it is also possible to modify these settings simply by right clicking on the command prompt's title bar, and modifying Properties -> Layout. Similarly, you can set the resolution for any shortcuts to CMD.EXE and batch files (Right click the shortcut -> Properties -> Layout). This only works for CMD.EXE, however, not COMMAND.COM.

Solution 5 - Cmd

A simple command to fix the window size that I use all the time:

wmic

It will open the Windows Management Instrumentation Command-line and remove the size limits. Then just close it with Ctrl+C.

Solution 6 - Cmd

I don't know the history behind it, but this wishlist item from the author of PuTTy is an interesting post that explains the technical hurdles involved with any type of cmd.exe replacement that isn't lame:

<http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/win-command-prompt.html>

You don't mention that you're looking for a replacement, but if so you might also check out some of the cmd.exe replacements like Console 2 or JP Software's Take Command etc. I've also had some good experiences with PuTTy-Cyg which lets you use PuTTy as a cygwin shell.

Solution 7 - Cmd

While the width is not limited as other answers show, I've always found it strange that one can drag and resize the height with the mouse, but not the width.

I think the default 80 character width is related to compatibility with old programs that assume the terminal won't be more than 80 characters wide. I don't think this has been a realistic reason for a decade or so, though.

Solution 8 - Cmd

As others have pointed out, it's not limited to 80 characters wide, but my guess as to why it defaults to 80 characters would be that it's left over from the DOS days where CRT displays were 80 characters wide.

See also

Solution 9 - Cmd

You could also use a different terminal application, such as Console2, which allows you to resize the window all you want (among other things, such as transparency, and the ability to use any font you'd like). It's a great application, I've switched to it and now I only use cmd.exe when I absolutely have to.

Solution 10 - Cmd

Since it will scroll left to right as well as up and down, the very first thing I do on a system is define my width as 180 and save it. That's generally enough so that stack traces don't have to wrap for the most part, but not so much that you are waisting a ton of space.

While you're at it, set the vertical size (scrollback buffer) to all 9's. You'll be glad you did some day.

Solution 11 - Cmd

Because MS value "backwards compatibility" over a lot of things and in this case I suspect it's a misplaced belief that it will somehow unnerve people if they don't have their standard 80 wide window.

Of course it could be that it was programmed for a fixed 80 chars width when that was pretty much universal, and the additional property settings were a bit of a hack.

Solution 12 - Cmd

It IS limited. Check it out. (I mean window size NOT buffer)

You will find that the maximum width you can set is limited but varies according to your screen resolution. If your resolution is set to 1024 x 768 you will find that you can only get to 128 on the command prompt width. 128/1024=.125

you will find that ratio to be consistent across the board. I have an RDP session running at 2000x768 (across two of my three monitors) and get a max width of 250.

Now, that actaully turns out to be a little bigger than your actaul monitor size but I have three monitors all running individual desktops. (so in essence, 3 1024x768 resolutions) and if I want to do something SO SIMPLE as stretch a command prompt across 2 or more monitors, I CAN'T. (I want to when doing things with very long paths (diruse.exe/etc.)...

-c

Solution 13 - Cmd

Solution 14 - Cmd

Because improving the usability and functionality of anything that Unix/GNU-like development requires will undermine Windows as a commercial platform for Microsoft's partners. Preventing this means other large companies' products for developers, such as improved terminals, and other general third party products, like word processors, video players etc. aren't competing with existing Unix/GNU software. Without this, Windows wouldn't be a profitable platform, and Microsoft would lose its desktop monopoly.

This is why the terminal sucks, there's no POSIX API, no C99 support in MSVC and the list goes on. To clarify, common Unix/GNU technologies and development are intentionally unsupported so that large commercial software houses don't have to compete with them.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmintyView Question on Stackoverflow
Solution 1 - CmdericksonView Answer on Stackoverflow
Solution 2 - CmdjmucchielloView Answer on Stackoverflow
Solution 3 - CmdTim StewartView Answer on Stackoverflow
Solution 4 - CmdCoding With StyleView Answer on Stackoverflow
Solution 5 - CmdMijacrView Answer on Stackoverflow
Solution 6 - CmdJayView Answer on Stackoverflow
Solution 7 - CmdGreg HewgillView Answer on Stackoverflow
Solution 8 - CmdPatrick CuffView Answer on Stackoverflow
Solution 9 - CmdSasha ChedygovView Answer on Stackoverflow
Solution 10 - CmdBill KView Answer on Stackoverflow
Solution 11 - CmdDraemonView Answer on Stackoverflow
Solution 12 - CmdChris KingView Answer on Stackoverflow
Solution 13 - CmdrferrisxView Answer on Stackoverflow
Solution 14 - CmdMatt JoinerView Answer on Stackoverflow