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

前端 未结 14 1466
死守一世寂寞
死守一世寂寞 2021-01-30 04:03

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

相关标签:
14条回答
  • 2021-01-30 04:24

    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.

    0 讨论(0)
  • 2021-01-30 04:26

    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.

    0 讨论(0)
提交回复
热议问题